import { Node } from "prosemirror-model"; import { EditorState, Transaction } from "prosemirror-state"; import { EditorSchema } from "../schema"; import { TableColumnIndex, TableNode, TableRowIndex, TableStart } from "../types"; import { TableMap } from "./TableMap"; /** * Toggle the entire table being selected. * * @param tr Transaction to contribute to * @param tableStart Start position of the table in doc * @param tableMap A pre-computed table map */ export declare function toggleTableSelection(tr: Transaction, table: TableNode, tableStart: TableStart, tableMap?: TableMap): void; /** * Select all cells in the active table. */ export declare function selectAll(tr: Transaction): boolean; /** * Add a column at a specific index in a table. * * @param tr Transaction to contribute to * @param table ProseMirror node of the table * @param tableStart Start position of the table in doc * @param tableMap A pre-computed table map * @param columnEdgeIndex 0-indexed column edge of where to insert the column */ export declare function addColumn(tr: Transaction, table: TableNode, tableStart: TableStart, tableMap: TableMap, columnEdgeIndex: number): Transaction; /** * Add a row at a specific index in the table. * * @param tr Transaction to contribute to. * @param table ProseMirror node of the table * @param tableStart Position of the start of the table in the document (first * position inside it) * @param tableMap Precomputed `TableMap` for the table * @param rowEdgeIndex 0-index of the row edge to insert to */ export declare function addRow(tr: Transaction, table: TableNode, tableStart: TableStart, tableMap: TableMap, rowEdgeIndex: number): Transaction; /** * Delete a table. * * @param tr Transaction to contribute to * @param tableStart Position of the start of the table in the document (first * position inside it) */ export declare function deleteTable(tr: Transaction, tableStart: TableStart): boolean; /** * Remove a range of columns from a table. * * Returns `true` if it was able to successfully delete the columns. If the * table would end up empty (i.e. no columns), the entire table is deleted. * * @param tr Transaction to contribute to * @param tableStart Position of the start of the table in the document (first * position inside it) * @param columnStart 0-index of the first column to remove * @param columnEnd 0-index of the last column to remove */ export declare function removeColumns(tr: Transaction, tableStart: TableStart, columnStart: TableColumnIndex, columnEnd?: TableColumnIndex): boolean; /** * Remove a row from a table. * * @param tr Transaction to contribute to * @param tableStart Position of the start of the table in the document (first position inside it) * @param rowStart 0-index of the first row to remove * @param rowEnd 0-index of the last row to remove */ export declare function removeRows(tr: Transaction, tableStart: TableStart, rowStart: TableRowIndex, rowEnd?: TableRowIndex): boolean; /** * Returns true if the row is a header row (all cells are header cells). * * @param table ProseMirror node for the table * @param rowIndex 0-index of the row to check * @param tableMap TableMap for table */ export declare function rowIsHeader(table: Node, rowIndex: number, tableMap: TableMap): boolean; /** * Inspect all tables in the given state's document and return a * transaction that fixes them, if necessary. If `oldState` was * provided, that is assumed to hold a previous, known-good state, * which will be used to avoid re-scanning unchanged parts of the * document. */ export declare function fixTables(state: EditorState, oldState?: EditorState): Transaction | undefined; /** * Fix the given table, if necessary. Will append to the transaction it was * given, if non-null, or create a new one if necessary. */ export declare function fixTable(state: EditorState, table: TableNode, tableStart: TableStart, tr?: Transaction): Transaction | undefined;