aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/formattedText
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2022-07-07 13:02:33 -0400
committerbobzel <zzzman@gmail.com>2022-07-07 13:02:33 -0400
commitdd16695b0c5fe8c54bc276a230381ae36e19e5ac (patch)
tree0544131ca2fb0d6f3cfae81aa5bbbb8b603b61ac /src/client/views/nodes/formattedText
parenta9f704fbd5676bb9a8adf4c4f7ea61bf9b3f7603 (diff)
trying to fix errors in compiles
Diffstat (limited to 'src/client/views/nodes/formattedText')
-rw-r--r--src/client/views/nodes/formattedText/schema_rts.ts13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/client/views/nodes/formattedText/schema_rts.ts b/src/client/views/nodes/formattedText/schema_rts.ts
index 83561073c..d6e0e6002 100644
--- a/src/client/views/nodes/formattedText/schema_rts.ts
+++ b/src/client/views/nodes/formattedText/schema_rts.ts
@@ -1,8 +1,7 @@
-import { Schema, Slice } from "prosemirror-model";
-
-import { nodes } from "./nodes_rts";
-import { marks } from "./marks_rts";
+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
@@ -20,7 +19,9 @@ 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);
+ // bcz: this is a hacky way to convert the JSON that's serialized for a summary node into the Slice that the summary node wants at run-time.
+ // since attrs are readonly, assigning the text field like this violates the way prosemirror works, but I think we can get away with it.
+ (node.attrs.text as any) = Slice.fromJSON(schema, node.attrs.textslice);
}
return node;
-}; \ No newline at end of file
+};