aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/RichTextRules.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-12-02 13:21:59 -0500
committerbob <bcz@cs.brown.edu>2019-12-02 13:21:59 -0500
commit1280c005829cf49fd106fd872afcf4ed6593a2f6 (patch)
tree1b137395d443fe58916d6e0bfbd9cd2e665c0e7b /src/client/util/RichTextRules.ts
parent68f49ef5daf3bf5c47d1d21c8f1cd2097947d071 (diff)
fixed inline text comments to highlight and hide/show.
Diffstat (limited to 'src/client/util/RichTextRules.ts')
-rw-r--r--src/client/util/RichTextRules.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/src/client/util/RichTextRules.ts b/src/client/util/RichTextRules.ts
index ebb9bda8a..f4c44e5ce 100644
--- a/src/client/util/RichTextRules.ts
+++ b/src/client/util/RichTextRules.ts
@@ -147,16 +147,14 @@ export const inpRules = {
new InputRule(
new RegExp(/##\s$/),
(state, match, start, end) => {
+ let target = Docs.Create.TextDocument({ width: 75, height: 35, autoHeight: true, fontSize: 9, title: "inline comment" });
let node = (state.doc.resolve(start) as any).nodeAfter;
+ let newNode = schema.nodes.dashComment.create({ docid: target[Id] });
+ let dashDoc = schema.nodes.dashDoc.create({ width: 75, height: 35, title: "dashDoc", docid: target[Id], float: "right" });
let sm = state.storedMarks || undefined;
- let target = Docs.Create.TextDocument({ width: 75, height: 35, autoHeight: true, fontSize: 9, title: "inline comment" });
- let replaced = node ? state.tr.insertText("←", start).replaceRangeWith(start + 1, end + 1, schema.nodes.dashDoc.create({
- width: 75, height: 35,
- title: "dashDoc", docid: target[Id],
- float: "right"
- })).setStoredMarks([...node.marks, ...(sm ? sm : [])]) :
+ let replaced = node ? state.tr.insert(start, newNode).replaceRangeWith(start + 1, end + 1, dashDoc).setStoredMarks([...node.marks, ...(sm ? sm : [])]) :
state.tr;
- return replaced.setSelection(new TextSelection(replaced.doc.resolve(end - 1)));
+ return replaced;//.setSelection(new NodeSelection(replaced.doc.resolve(end)));
}),
new InputRule(
new RegExp(/\(\(/),