How to use the @jupyterlab/cells.CellDragUtils.createCellDragImage function in @jupyterlab/cells

To help you get started, we’ve selected a few @jupyterlab/cells examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jupyterlab / jupyterlab / packages / console / src / widget.ts View on Github external
private _startDrag(
    index: number,
    clientX: number,
    clientY: number
  ): Promise {
    const cellModel = this._focusedCell.model as ICodeCellModel;
    let selected: nbformat.ICell[] = [cellModel.toJSON()];

    const dragImage = CellDragUtils.createCellDragImage(
      this._focusedCell,
      selected
    );

    this._drag = new Drag({
      mimeData: new MimeData(),
      dragImage,
      proposedAction: 'copy',
      supportedActions: 'copy',
      source: this
    });

    this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);
    const textContent = cellModel.value.text;
    this._drag.mimeData.setData('text/plain', textContent);
github jupyterlab / jupyterlab-data-explorer / jupyterlab / packages / console / src / widget.ts View on Github external
private _startDrag(index: number, clientX: number, clientY: number) {
    const cellModel = this._focusedCell.model as ICodeCellModel;
    let selected: nbformat.ICell[] = [cellModel.toJSON()];

    const dragImage = CellDragUtils.createCellDragImage(
      this._focusedCell,
      selected
    );

    this._drag = new Drag({
      mimeData: new MimeData(),
      dragImage,
      proposedAction: 'copy',
      supportedActions: 'copy',
      source: this
    });

    this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);
    const textContent = cellModel.value.text;
    this._drag.mimeData.setData('text/plain', textContent);
github jupyterlab / jupyterlab / packages / console / src / widget.ts View on Github external
private _startDrag(
    index: number,
    clientX: number,
    clientY: number
  ): Promise {
    let selected: nbformat.ICell[] = [
      CodeCellData.toJSON(this._focusedCell.data)
    ];

    const dragImage = CellDragUtils.createCellDragImage(
      this._focusedCell,
      selected
    );

    this._drag = new Drag({
      mimeData: new MimeData(),
      dragImage,
      proposedAction: 'copy',
      supportedActions: 'copy',
      source: this
    });

    this._drag.mimeData.setData(JUPYTER_CELL_MIME, selected);
    const textContent = this._focusedCell.editor.model.value;
    this._drag.mimeData.setData('text/plain', textContent);