add getNodeType

This commit is contained in:
Philipp Kühn
2020-04-22 00:09:31 +02:00
parent 023c16a4f5
commit 3d02da20ff
3 changed files with 17 additions and 5 deletions

View File

@@ -0,0 +1,9 @@
import { NodeType, Schema } from 'prosemirror-model'
export default function getNodeType(nameOrType: string | NodeType, schema: Schema): NodeType {
if (typeof nameOrType === 'string') {
return schema.nodes[nameOrType]
}
return nameOrType
}