Skip to content

Type Editor


Type Editor / @type-editor/tables / schema / tableNodes

Function: tableNodes()

ts
function tableNodes(options): TableNodes;

Defined in: tables/src/schema.ts:305

Creates node specifications for table-related nodes.

This function generates a set of https://prosemirror.net/docs/ref/#model.NodeSpec|NodeSpec objects for table, table_row, table_cell, and table_header node types. The result can be spread into your schema's nodes when creating a new schema.

Parameters

ParameterTypeDescription
optionsTableNodesOptionsConfiguration options for the table nodes.

Returns

TableNodes

An object containing node specifications for all table-related nodes.

Example

typescript
import { Schema } from "prosemirror-model";
import { tableNodes } from "./schema";

const schema = new Schema({
  nodes: {
    doc: { content: "block+" },
    paragraph: { group: "block", content: "text*" },
    text: {},
    ...tableNodes({
      tableGroup: "block",
      cellContent: "paragraph+",
      cellAttributes: {},
    }),
  },
});