Provides table-related schema elements (nodes like table, table_row, table_cell, table_header) and editing commands (addRowBefore, addRowAfter, addColBefore, addColAfter, toggleHeaderRow, toggleHeaderColumn, toggleHeaderCell, deleteRow, deleteCol, mergeCells, splitCell, setCellAttr, goToNextCell) for the ProseMirror rich text editor. Current stable version is 0.22.0, released under a beta lifecycle with semver 0.x meaning API may change across minor versions. Key differentiator: tightly integrated with ProseMirror's schema and state management, unlike alternative table implementations. Supports row/column operations, cell merging, header toggling, and keyboard navigation. Requires prosemirror-model, prosemirror-transform, prosemirror-state, prosemirror-view, prosemirror-keymap, prosemirror-commands as peer dependencies.
npm install prosemirror-schema-tableNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Sets up a ProseMirror editor with table schema and tableEditing plugin, then inserts a 2x2 table and adds a row after the first row.
Pin exact version in package.json (e.g., "0.22.0") and test upgrades manually. Follow changelog at https://github.com/ProseMirror/prosemirror/blob/master/CHANGELOG.md
Replace `fixTables` with the `tableEditing` plugin: import { tableEditing } from 'prosemirror-schema-table';Ensure the editor has a cell selection (use `goToNextCell` or mouse click inside a cell) before calling mergeCells/splitCell.
Use `Schema({ nodes: schema.spec.nodes.append(tableSchema.spec.nodes), marks: schema.spec.marks })`Wrap `tableEditing()` in a condition: `typeof document !== 'undefined' ? tableEditing() : []`
Ensure tableSchema is imported: import { tableSchema } from 'prosemirror-schema-table'; and use it when creating Schema.Include tableSchema nodes: `const mySchema = new Schema({ nodes: baseSchema.spec.nodes.append(tableSchema.spec.nodes), marks: baseSchema.spec.marks })`Use the exact named import: `import { addRowAfter } from 'prosemirror-schema-table';`