New

docx-editor 1.x has shipped. Vue support, i18n, agents. Read the migration guide →

API Referencev1.0.2

@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)

declare function createTableExtensions(): AnyExtension[];
declare function getTableContext(state: EditorState): TableContextInfo;
declare function goToNextCell(): Command;
declare function goToPrevCell(): Command;
declare function isInTableCell(state: EditorState): boolean;
TableCellExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension
TableHeaderExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension
TableNodeExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension
TablePluginExtension: (options?: Partial<Record<string, unknown>> | undefined) => Extension
TableRowExtension: (options?: Partial<Record<string, unknown>> | undefined) => NodeExtension

Interfaces(1)

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
MemberTypeSummary
canSplitCell?boolean
cellBackgroundColor?stringCurrent cell's background/fill color (RGB hex without #), if any
cellBorderColor?ColorValueCurrent cell's dominant border color, if any
columnCount?number
columnIndex?number
hasMultiCellSelection?boolean
isInTableboolean
rowCount?number
rowIndex?number
table?Node
tablePos?number

Type aliases(2)

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;
    };
};