diff --git a/wax-prosemirror-core/config/classes/createSchema.js b/wax-prosemirror-core/config/classes/createSchema.js new file mode 100644 index 0000000000000000000000000000000000000000..2b3005b14f711f5988f1136c6c36587bfe0361ea --- /dev/null +++ b/wax-prosemirror-core/config/classes/createSchema.js @@ -0,0 +1,33 @@ +import { Schema } from "prosemirror-model"; + +class createSchema { + constructor(schema) { + if (!schema) { + throw new Error("schema is mandatory"); + } + const { nodes, marks } = schema; + + if (!nodes || !marks) { + throw new Error("no nodes or marks found"); + } + + this.nodes = nodes; + this.marks = marks; + return this.initSchema(); + } + + initSchema() { + return new Schema(this.toJSON()); + } + + toJSON() { + return { + nodes: this.nodes, + marks: this.marks + }; + } + + setDefaultSchema() {} +} + +export default createSchema;