aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText/schema_rts.ts
diff options
context:
space:
mode:
authorusodhi <61431818+usodhi@users.noreply.github.com>2020-05-04 12:22:04 +0530
committerusodhi <61431818+usodhi@users.noreply.github.com>2020-05-04 12:22:04 +0530
commit95ec58135f3534640afc0a38d8c4bbbb84bc3434 (patch)
tree2b04fb11d2f821155668c4ebcec3a86229a01acb /src/client/views/nodes/formattedText/schema_rts.ts
parenta2eb8ba283ce4a8fb7f423a9198e2a5778eba886 (diff)
parent1027f0b2e40df0ca13dfa2db97f278e804dadb68 (diff)
finishing merge
Diffstat (limited to 'src/client/views/nodes/formattedText/schema_rts.ts')
-rw-r--r--src/client/views/nodes/formattedText/schema_rts.ts26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/client/views/nodes/formattedText/schema_rts.ts b/src/client/views/nodes/formattedText/schema_rts.ts
new file mode 100644
index 000000000..83561073c
--- /dev/null
+++ b/src/client/views/nodes/formattedText/schema_rts.ts
@@ -0,0 +1,26 @@
+import { Schema, Slice } from "prosemirror-model";
+
+import { nodes } from "./nodes_rts";
+import { marks } from "./marks_rts";
+
+
+// :: Schema
+// This schema rougly corresponds to the document schema used by
+// [CommonMark](http://commonmark.org/), minus the list elements,
+// which are defined in the [`prosemirror-schema-list`](#schema-list)
+// module.
+//
+// To reuse elements from this schema, extend or read from its
+// `spec.nodes` and `spec.marks` [properties](#model.Schema.spec).
+
+export const schema = new Schema({ nodes, marks });
+
+const fromJson = schema.nodeFromJSON;
+
+schema.nodeFromJSON = (json: any) => {
+ const node = fromJson(json);
+ if (json.type === schema.nodes.summary.name) {
+ node.attrs.text = Slice.fromJSON(schema, node.attrs.textslice);
+ }
+ return node;
+}; \ No newline at end of file