diff options
author | bob <bcz@cs.brown.edu> | 2019-06-12 12:35:59 -0400 |
---|---|---|
committer | bob <bcz@cs.brown.edu> | 2019-06-12 12:35:59 -0400 |
commit | a4f5005fedae93bd4bb1529561acaa8d4f0474c5 (patch) | |
tree | 6151c8f46a95b1738ebd518d64e821aedb0dc3b4 /src/client/util/RichTextSchema.tsx | |
parent | ce9adde20b611ea8300c402416ef41e4fb960919 (diff) |
"fixed" prosemirror serialization of 'star' schema node
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r-- | src/client/util/RichTextSchema.tsx | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/client/util/RichTextSchema.tsx b/src/client/util/RichTextSchema.tsx index db62f3ac1..d1282403f 100644 --- a/src/client/util/RichTextSchema.tsx +++ b/src/client/util/RichTextSchema.tsx @@ -90,6 +90,7 @@ export const nodes: { [index: string]: NodeSpec } = { attrs: { visibility: { default: false }, oldtext: { default: undefined }, + oldtextslice: { default: undefined }, oldtextlen: { default: 0 } }, @@ -502,10 +503,9 @@ export const schema = new Schema({ nodes, marks }); const fromJson = schema.nodeFromJSON; schema.nodeFromJSON = (json: any) => { - if (json.type !== "star") { - return fromJson(json); + let node = fromJson(json); + if (json.type === "star") { + node.attrs.oldtext = Slice.fromJSON(schema, node.attrs.oldtextslice); } - let x = fromJson(json); - x.attrs.oldtext = Slice.fromJSON(x.attrs.oldtext); - return x; + return node; }
\ No newline at end of file |