add createTable

This commit is contained in:
Hans Pagel
2021-01-22 22:37:43 +01:00
parent d3fcbc91c3
commit d1bbc8f24d
5 changed files with 81 additions and 25 deletions

View File

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