@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)
createTableExtensions
declare function createTableExtensions(): AnyExtension[];getTableContext
declare function getTableContext(state: EditorState): TableContextInfo;declare function goToNextCell(): Command;declare function goToPrevCell(): Command;declare function isInTableCell(state: EditorState): boolean;TableCellExtension
TableCellExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTableHeaderExtension
TableHeaderExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTableNodeExtension
TableNodeExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionTablePluginExtension
TablePluginExtension: (options?: Partial<Record<string, unknown>> | undefined) => ExtensionTableRowExtension
TableRowExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtensionInterfaces(1)
TableContextInfo
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)
BorderPreset
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';type BorderSpec = {
style: string;
size: number;
color: {
rgb: string;
};
};