diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-06-12 03:00:59 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-06-12 03:00:59 -0400 |
commit | a7cb61db19c3e34dcf3c91152c04d4aea2980682 (patch) | |
tree | 06e4ec7c4aaca972984dcd79a317ec8842ff775e /src/client/util/TooltipTextMenu.tsx | |
parent | 366ac7e434be306ffd979d7f22ef50ad77fbc1eb (diff) |
prototyep working version of elision -- however, it doesn't work once the text box is deselected/reloaded. didn't look into why
Diffstat (limited to 'src/client/util/TooltipTextMenu.tsx')
-rw-r--r-- | src/client/util/TooltipTextMenu.tsx | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx index 905f1969c..6cc71be39 100644 --- a/src/client/util/TooltipTextMenu.tsx +++ b/src/client/util/TooltipTextMenu.tsx @@ -274,21 +274,11 @@ export class TooltipTextMenu { insertStar(state: EditorState<any>, dispatch: any) { console.log("creating star..."); - let type = schema.nodes.star; - let select = state.selection; - let node = select.$from.nodeAfter; - if (node) { - if (node.type.name === "star") { - let oldselection = node.attrs.oldtext; - if (dispatch) { - dispatch(state.tr.replaceSelection(oldselection.content())); - } - return true; - } - } + let newNode = schema.nodes.star.create(); if (dispatch) { - let newNode = type.create(); - newNode.attrs.oldtext = select; + newNode.attrs.visibility = false; + newNode.attrs.oldtext = state.selection.content(); + newNode.attrs.oldtextlen = state.selection.to - state.selection.from; dispatch(state.tr.replaceSelectionWith(newNode)); } return true; |