Files
tiptap/packages/extension-table/src/utilities/createCell.ts
Philipp Kühn 56417a44a7 refactoring
2021-01-23 22:48:34 +01:00

14 lines
387 B
TypeScript

import {
NodeType, Fragment,
Node as ProsemirrorNode,
Schema,
} from 'prosemirror-model'
export function createCell(cellType: NodeType, cellContent?: Fragment<Schema> | ProsemirrorNode<Schema> | Array<ProsemirrorNode<Schema>>): ProsemirrorNode | null | undefined {
if (cellContent) {
return cellType.createChecked(null, cellContent)
}
return cellType.createAndFill()
}