1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 725× 5206× 5206× 5206× | class DocumentNodeFactory { constructor(doc) { this.doc = doc } create(nodeType, nodeData) { var NodeClass = this.doc.schema.getNodeClass(nodeType) Iif (!NodeClass) { throw new Error('No node registered by that name: ' + nodeType) } return new NodeClass(this.doc, nodeData) } } export default DocumentNodeFactory |