import { ApplySchemaAttributes, CommandFunction, CreateExtensionPlugin, EditorState, Helper, KeyBindingProps, NodeExtension, NodeSpecOverride, NonChainableCommandFunction, OnSetOptionsProps, ProsemirrorPlugin, StateUpdateLifecycleProps } from '@remirror/core'; import { CreateEventHandlers } from '@remirror/extension-events'; import { CreateTableCommand, TableSchemaSpec } from './table-utils'; export interface TableResizableOptions { handleWidth?: number; cellMinWidth?: number; } export interface TableOptions { /** * When `true` the table will be resizable. * * @defaultValue true */ resizable?: boolean; /** * The options passed to the column resizing plugin */ resizeableOptions?: TableResizableOptions; /** * Whether to use Tab and Shift-Tab to navigate between cells * * @defaultValue: false */ tabKeyboardShortcuts?: boolean; } export declare class TableExtension extends NodeExtension { private lastGoodState?; get name(): "table"; createTags(): "block"[]; /** * The last known good state that didn't need fixing. This helps make the fix * command more effective. */ createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): TableSchemaSpec; /** * Create the table extensions. Set the priority to low so that they appear * lower down in the node list. */ createExtensions(): TableRowExtension[]; onStateUpdate(props: StateUpdateLifecycleProps): void; createEventHandlers(): CreateEventHandlers; /** * Add the table plugins to the editor. */ createExternalPlugins(): ProsemirrorPlugin[]; createPlugin(): CreateExtensionPlugin; /** * Create a table in the editor at the current selection point. */ createTable(options?: CreateTableCommand): CommandFunction; /** * Delete the table. */ deleteTable(): CommandFunction; /** * Command to add a column before the column with the selection. */ addTableColumnBefore(): CommandFunction; /** * Command to add a column after the column with the selection. */ addTableColumnAfter(): CommandFunction; /** * Remove selected column from the table. */ deleteTableColumn(): CommandFunction; /** * Add a table row before the current selection. */ addTableRowBefore(): CommandFunction; /** * Add a table row after the current selection. */ addTableRowAfter(): CommandFunction; /** * Delete the table row at the current selection. */ deleteTableRow(): CommandFunction; /** * Toggles between merging cells. */ toggleTableCellMerge(): CommandFunction; /** * Merge the table cells. */ mergeTableCells(): CommandFunction; /** * Split the merged cells into individual cells. */ splitTableCell(): CommandFunction; /** * Toggles between row/column header and normal cells (Only applies to first row/column). */ toggleTableHeader(type?: 'column' | 'row'): CommandFunction; /** * Toggles a column as the header column. */ toggleTableHeaderColumn(): CommandFunction; /** * Toggles a row as a table header row. */ toggleTableHeaderRow(): CommandFunction; /** * Toggle a cell as a table header cell. */ toggleTableHeaderCell(): CommandFunction; /** * Set the attribute for a table cell. */ setTableCellAttribute(name: string, value: unknown): CommandFunction; /** * Fix all tables within the document. * * This is a **non-chainable** command. */ fixTables(): NonChainableCommandFunction; /** * Enable table usage within the editor. This depends on the browser that * is being used. */ enableTableSupport(): Helper; /** * Determines if the first row/column is a header row/column */ tableHasHeader(type?: 'column' | 'row', state?: EditorState): Helper; /** * Update the background of one cell or multiple cells by passing a color * string. You can also remove the color by passing a `null`. */ setTableCellBackground(background: string | null): CommandFunction; selectParentCell(): CommandFunction; expandCellSelection(type?: 'column' | 'row' | 'all'): CommandFunction; goToNextCell(props: KeyBindingProps): boolean; goToPreviousCell(props: KeyBindingProps): boolean; /** * This managers the updates of the collaboration provider. */ protected onSetOptions(props: OnSetOptionsProps): void; } /** * The extension for a table row node. */ export declare class TableRowExtension extends NodeExtension { get name(): "tableRow"; /** * Automatically create the `TableCellExtension` and * `TableHeaderCellExtension`. This is placed here so that this extension can * be tested independently from the `TableExtension`. */ createExtensions(): Array; createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): TableSchemaSpec; } /** * The extension for a table cell node. */ export declare class TableCellExtension extends NodeExtension { get name(): "tableCell"; createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): TableSchemaSpec; } /** * The extension for the table header node. */ export declare class TableHeaderCellExtension extends NodeExtension { get name(): "tableHeaderCell"; createNodeSpec(extra: ApplySchemaAttributes, override: NodeSpecOverride): TableSchemaSpec; } /** * This is not used in the basic table extension, but is required for this React Tables extension that extends this */ export declare class TableControllerCellExtension extends NodeExtension { get name(): "tableControllerCell"; createNodeSpec(_: ApplySchemaAttributes, __: NodeSpecOverride): TableSchemaSpec; } declare global { namespace Remirror { interface AllExtensions { table: TableExtension; } } }