@eigenpal/docx-editor-core/prosemirror/extensions/nodes/TableExtension
Table Extension — 4 node specs + plugins + commands
Uses separate NodeExtension instances for each table node type, plus an Extension that registers the prosemirror-tables editing plugins, the Backspace/Delete keymap chain, and the full 32-command surface.
NodeSpecs (declarative attrs + parseDOM + toDOM) and the CSS-paste helpers shared by td/th live in ./specs,paste.ts. The table-context query / cell-navigation helpers live in ./context.ts. The plugin runtime itself lives under ./commands/ — one file per command domain (insert, delete, selection, borders, cellFormatting, sizing, tableStyle), plus shared helpers and the active-cell decoration plugin.
Functions (10)
createTableExtensionsfunctionSource ↗
declare function createTableExtensions(): AnyExtension[];getTableContextfunctionSource ↗
declare function getTableContext(state: EditorState): TableContextInfo;goToNextCellfunctionSource ↗
declare function goToNextCell(): Command;goToPrevCellfunctionSource ↗
declare function goToPrevCell(): Command;isInTablefunctionSource ↗
declare function isInTableCell(state: EditorState): boolean;TableCellExtensionfunctionSource ↗
TableCellExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTableHeaderExtensionfunctionSource ↗
TableHeaderExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTableNodeExtensionfunctionSource ↗
TableNodeExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTablePluginExtensionfunctionSource ↗
TablePluginExtension: (options?: Partial<Record<string, unknown>> | undefined) => ExtensionTableRowExtensionfunctionSource ↗
TableRowExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionInterfaces (1)
TableContextInfointerfaceSource ↗
Table selection context + navigation helpers.
getTableContext walks the selection up from $from and reports which table / row / cell the cursor is in, plus the table's row/column counts, whether a multi-cell selection is active, and the current cell's border + fill colors (so the toolbar's color pickers can show the live values).
goToNextCell / goToPrevCell are tab-stop-style cell navigation commands registered by the plugin extension.
interface TableContextInfo| Member | Type | Summary |
|---|---|---|
| canSplitCell? | boolean | |
| cellBackgroundColor? | string | Current cell's background/fill color (RGB hex without #), if any |
| cellBorderColor? | ColorValue | Current cell's dominant border color, if any |
| columnCount? | number | |
| columnIndex? | number | |
| hasMultiCellSelection? | boolean | |
| isInTable | boolean | |
| rowCount? | number | |
| rowIndex? | number | |
| table? | Node | |
| tablePos? | number |
Type aliases (2)
BorderPresettypeSource ↗
Cell-border commands. Each command applies a preset / individual side / color / width to the cells targeted by the current selection (single cursor cell or active CellSelection).
All four commands use the shared buildTableGrid lookup to find each cell's neighbours in the grid, then sync the matching edge on the adjacent cell — Google-Docs style edge-symmetric border editing.
Schema-free: only attribute updates via tr.setNodeMarkup.
type BorderPreset = 'all' | 'outside' | 'inside' | 'none';BorderSpectypeSource ↗
type BorderSpec = {
style: string;
size: number;
color: {
rgb: string;
};
};