export declare function isTableElement(node: Node | null): node is HTMLTableElement; export declare function isTableSectionElement(node: Node | null): node is HTMLTableSectionElement; export declare function isTableHeadElement(node: Node | null): node is HTMLTableSectionElement; export declare function isTableRowElement(node: Node | null): node is HTMLTableRowElement; export declare function isTableCellElement(node: Node | null): node is HTMLTableCellElement; export declare function getFirstColumnCells(table: HTMLTableElement): HTMLTableCellElement[]; export declare function getVerticalAlignedCells(table: HTMLTableElement, refCell: HTMLTableCellElement): TablePlan; export declare function getHorizontalAlignedCells(table: HTMLTableElement, refCell: HTMLTableCellElement): TablePlan; export declare function getMaxBorderTopWidth(table: HTMLTableElement): number | null; export declare function getMaxBorderLeftWidth(table: HTMLTableElement): number | null; export declare function getFirstNonEmptyRow(table: HTMLTableElement): HTMLTableRowElement | null; /** * A TablePlan is a matrix representation of a table or of a group of cells: * - Each of its subarray are matrix's row. * - Each of the subarray items are matrix's cell. * - Each matrices's cell points to a TableCell. * It provides the following guarantees: * - Each cell of the matrix represents a TableCell or a part of a TableCell. A TableCell of dimension n*m greater than 1*1 will occupy n*m matrix's cell. * - Horizontal order is respected: consecutive matrix's cell represent consecutive TableCells, in the same order. * - Vertical alignment is respected. */ export declare type TablePlan = HTMLTableCellElement[][]; /** * Return the tablePlan matching table. * @param canOverflow will determine weather a spreading cell can create an more rows/columns in tablePlan than in its original table/section. * - By default, when displayed in browsers, cells cannot spread beyond their table/section number of rows/columns. * For instance: If a table contains only one row, and a cell which rowspan > 1, it will be ignore and the table * will keep its original number of rows. To reflect this behavior in the corresponding tablePlan, canOverflow must be false. * - However, when copy/pasting, cells spreading on several rows, the user will want to paste what he saw. * In such case, if copying one cell spreading on two existing rows from a table, the number of rows in the clipboard will only be one. * Yet we want the tablePlan reflecting the clipboard content to capture the information that this cell originally spread on two rows. * In order to do that, the spreading cell is allowed to created more rows in the tablePlan than the number of rows in its table by * setting canOverlow to true. */ export declare function getTablePlan(table: HTMLTableElement, canOverflow?: boolean): TablePlan; /** * Returns the TablePlan matching the subtable defined by current selection in a table. * This subtable includes all cells that are: * - at same row or bellow anchorNode * - at same row or above focusNode * - at same column or right to anchorNode * - at same column or left to focusNode * There is no such subtable if: * - anchorNode or focusNode are not on a HTMLTableCellElement, * - anchorNode or focusNode are not in the same HTMLTableElement */ export declare function getSelectedCellsPlan(element: Element, range: Range): HTMLTableCellElement[][] | null; /** * Return table whose content is the same as in tablePlan. */ export declare function getTableFromTablePlan(tablePlan: TablePlan): HTMLTableElement | null; export interface TableCellCoordinate { row: number; column: number; } export declare function getCellCoordinateInPlan(cell: HTMLTableCellElement, tablePlan: TablePlan): TableCellCoordinate | null; export declare function getCellCountInPlan(tablePlan: TablePlan): number; export declare function getFirstCellInPlan(tablePlan: TablePlan): HTMLTableCellElement | null; export declare function getLastCellInPlan(tablePlan: TablePlan): HTMLTableCellElement | null; export declare function isSameTablePlan(tp1: TablePlan | null, tp2: TablePlan | null): boolean; /** * Add an empty row in table above refCell. */ export declare function addRowAboveCell(table: HTMLTableElement, refCell: HTMLTableCellElement): void; /** * Add an empty row in table under refCell. */ export declare function addRowUnderCell(table: HTMLTableElement, refCell: HTMLTableCellElement): void; /** * Add an empty column in table at the left of refCell. */ export declare function addColumnLeftToCell(table: HTMLTableElement, refCell: HTMLTableCellElement): void; /** * Add an empty column in table at the right of refCell. */ export declare function addColumnRightToCell(table: HTMLTableElement, refCell: HTMLTableCellElement): void; /** * Remove each cell contained in tableSectionPlan from table. */ export declare function deleteCells(table: HTMLTableElement, tableSectionPlan: TablePlan): boolean; /** * Mutates table so that all rows have the same length by appending empty cells to them. * A row's dimension is the sum of the colSpan value of its cells. */ export declare function makeTableRectangle(table: HTMLTableElement): void; export declare function emptyCells(cells: TablePlan): void; /** * Make sure cell has border. * Uses some provided computedStyle instead of computing cell's style * because this function might be called after cell is created but before it get appended to DOM. * In such case, computing style on cell would only gives empty strings, * computedStyle parameter enable to provide some other cell's style used as model. */ export declare function maybeFixCellBorder(cell: HTMLTableCellElement, computedStyle: CSSStyleDeclaration | null): void; /** * Append a new row to table filled with nbEmptyCells empty cells. */ export declare function appendNewRowToTable(table: HTMLTableElement, nbEmptyCells: number, document: Document): HTMLTableRowElement; /** * Append a new cell to row. */ export declare function appendNewCellToRow(table: HTMLTableElement, row: HTMLTableRowElement, document: Document): HTMLTableCellElement; export declare function addCellBefore(table: HTMLTableElement, cell: HTMLTableCellElement): HTMLTableCellElement | null; export declare function addCellAfter(table: HTMLTableElement, cell: HTMLTableCellElement): HTMLTableCellElement | null; export declare function insertNewCellAtCoordinate(table: HTMLTableElement, document: Document, coordinate: TableCellCoordinate, rowSpan: number, colSpan: number): HTMLTableCellElement | null;