import { ResolvedPos } from "prosemirror-model"; import { EditorState, Selection } from "prosemirror-state"; import { EditorView } from "prosemirror-view"; import { CellAttrs } from "../schema"; import { Bias, CartesianAxis, DocNode, TableAxis, TableNode, TableStart } from "../types"; import * as dom from "../util/dom"; import { CellSelection } from "./CellSelection"; import { EdgeRect } from "./EdgeRect"; import { TableMap } from "./TableMap"; export declare function editable(view: EditorView): boolean; export declare function cellAround($pos: ResolvedPos): ResolvedPos | null; export declare function isInTable(state: EditorState): boolean; export declare function selectionCell(state: EditorState): ResolvedPos | null; export declare function pointsAtCell($pos: ResolvedPos): boolean; export declare function moveCellForward($pos: ResolvedPos): ResolvedPos; export declare function inSameTable($a: ResolvedPos, $b: ResolvedPos): boolean; export declare function isColumnHeader(tableMap: TableMap, table: TableNode, col: number): boolean; export declare function findCell($pos: ResolvedPos): EdgeRect; export declare function colCount($pos: ResolvedPos): number; export declare function nextCell($cellPos: ResolvedPos, axis: CartesianAxis, bias: Bias): ResolvedPos | null; /** * Reduce a cell's `colspan` attribute, omitting unused `colwidth` elements. */ export declare function shrinkColSpan(attrs: CellAttrs, columnIndex: number, count?: number): CellAttrs; export declare function expandColSpan(attrs: CellAttrs, pos: number, n?: number): { colwidth: ReadonlyArray | null; colspan: number; rowspan: number; }; export declare function closestDomCell(view: EditorView, searchStartNode: dom.Node): HTMLTableHeaderCellElement | HTMLTableDataCellElement | null; export declare const enum CellNearMouseStrategy { CARTESIAN_PROXIMITY = 0, DOM_HIERARCHY = 1 } export declare function cellNearMouse(view: EditorView, event: MouseEvent, strategy?: CellNearMouseStrategy): ResolvedPos | null; export declare function axisSelectionForCell($cell: ResolvedPos, axis: TableAxis): CellSelection; /** * Find a table node in a doc given the table’s start position. * * This method supports the doc itself being a table. * * @param doc * @param start Start position of the table (first position inside) relative to doc. */ export declare function findTable(doc: DocNode, start: TableStart): TableNode | null; export interface TableDescriptor { node: TableNode; start: TableStart; } /** * Find the closest table to the current selection ancestors. * * One of the challenges (performance) with applying decoration to certain types * of elements is finding all of those elements. Instead of searching the entire * document, a trick is to just find decorate elements that are ancestors of the * current selection. */ export declare function closestTableFromSelection(selection: Selection): TableDescriptor | null | void; /** * Find the closest ancestor table from a position in a document. */ export declare function closestTable($pos: ResolvedPos): TableDescriptor | null | void; /** * Check whether the cursor is at the end of a cell (so that further motion * would move out of the cell) */ export declare function atEndOfCell(view: EditorView, axis: CartesianAxis, bias: Bias): number | null;