1 | /**
|
2 | * This module contains some utility functions to operate on cells. This
|
3 | * could be shared by widgets that contain cells, like the CodeConsole or
|
4 | * Notebook widgets.
|
5 | */
|
6 | import { IterableOrArrayLike } from '@lumino/algorithm';
|
7 | import { Cell } from './widget';
|
8 | import * as nbformat from '@jupyterlab/nbformat';
|
9 | export declare namespace CellDragUtils {
|
10 | type ICellTargetArea = 'input' | 'prompt' | 'cell' | 'unknown';
|
11 | /**
|
12 | * Find the cell index containing the target html element.
|
13 | * This function traces up the DOM hierarchy to find the root cell
|
14 | * node. Then find the corresponding child and select it.
|
15 | *
|
16 | * @param node - the cell node or a child of the cell node.
|
17 | * @param cells - an iterable of Cells
|
18 | * @param isCellNode - a function that takes in a node and checks if
|
19 | * it is a cell node.
|
20 | *
|
21 | * @returns index of the cell we're looking for. Returns -1 if
|
22 | * the cell is not founds
|
23 | */
|
24 | function findCell(node: HTMLElement, cells: IterableOrArrayLike<Cell>, isCellNode: (node: HTMLElement) => boolean): number;
|
25 | /**
|
26 | * Detect which part of the cell triggered the MouseEvent
|
27 | *
|
28 | * @param cell - The cell which contains the MouseEvent's target
|
29 | * @param target - The DOM node which triggered the MouseEvent
|
30 | */
|
31 | function detectTargetArea(cell: Cell, target: HTMLElement): ICellTargetArea;
|
32 | /**
|
33 | * Detect if a drag event should be started. This is down if the
|
34 | * mouse is moved beyond a certain distance (DRAG_THRESHOLD).
|
35 | *
|
36 | * @param prevX - X Coordinate of the mouse pointer during the mousedown event
|
37 | * @param prevY - Y Coordinate of the mouse pointer during the mousedown event
|
38 | * @param nextX - Current X Coordinate of the mouse pointer
|
39 | * @param nextY - Current Y Coordinate of the mouse pointer
|
40 | */
|
41 | function shouldStartDrag(prevX: number, prevY: number, nextX: number, nextY: number): boolean;
|
42 | /**
|
43 | * Create an image for the cell(s) to be dragged
|
44 | *
|
45 | * @param activeCell - The cell from where the drag event is triggered
|
46 | * @param selectedCells - The cells to be dragged
|
47 | */
|
48 | function createCellDragImage(activeCell: Cell, selectedCells: nbformat.ICell[]): HTMLElement;
|
49 | }
|