aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextSchema.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/RichTextSchema.tsx')
-rw-r--r--src/client/util/RichTextSchema.tsx10
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