import { Node, ResolvedPos, Slice } from "prosemirror-model"; import { EditorState, Selection, SelectionBookmark, Transaction } from "prosemirror-state"; import { Mapping } from "prosemirror-transform"; import { TableStart } from "../types"; import { TableMap } from "./TableMap"; /** * A [`Selection`](http://prosemirror.net/docs/ref/#state.Selection) * subclass that represents a cell selection spanning part of a table. * With the plugin enabled, these will be created when the user * selects across cells, and will be drawn by giving selected cells a * `selectedCell` CSS class. */ export declare class CellSelection extends Selection { readonly $anchorCell: Readonly; readonly $headCell: Readonly; /** * A table selection is identified by its anchor and head cells. The positions * given to this constructor should point _before_ two cells in the same * table. They may be the same, to select a single cell. * * @param $anchorCell A resolved position pointing _in front of_ the anchor * cell (the one that doesn't move when extending the selection). * @param $headCell A resolved position pointing in front of the head cell * (the one moves when extending the selection). */ constructor($anchorCell: ResolvedPos, $headCell?: ResolvedPos); map(doc: Node, mapping: Mapping): Selection; /** * Returns a rectangular slice of table rows containing the selected cells. */ content(): Slice; replace(tr: Transaction, content?: Slice): void; replaceWith(tr: Transaction, node: Node): void; forEachCell(f: (node: Node, pos: number) => void): void; /** * True if this selection goes all the way from the left to the right of the table. */ isRowSelection(): boolean; /** * True if this selection goes all the way from the top to the bottom of the table. */ isColSelection(): boolean; /** * True if the entire table is selected. */ isTotalSelection(): boolean; eq(other: Selection): boolean; toJSON(): { type: string; anchor: number; head: number; }; getBookmark(): CellBookmark; /** * Returns the smallest column selection that covers the given anchor and head * cell. */ static colSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection; /** * Returns the smallest row selection that covers the given anchor and head * cell. */ static rowSelection($anchorCell: ResolvedPos, $headCell?: ResolvedPos): CellSelection; static fromJSON(doc: Node, json: { anchor: number; head: number; }): CellSelection; static create(doc: Node, anchorCell: number, headCell?: number): CellSelection; static createTotalSelection(doc: Node, tableStart: TableStart, tableMap: TableMap): CellSelection; static visible: boolean; } export declare class CellBookmark implements SelectionBookmark { private readonly anchor; private readonly head; constructor(anchor: number, head: number); map(mapping: Mapping): CellBookmark; resolve(doc: Node): Selection; } export declare function normalizeSelection(state: EditorState, tr?: Transaction): Transaction | undefined;