diff options
author | ab <abdullah_ahmed@brown.edu> | 2019-06-12 12:20:34 -0400 |
---|---|---|
committer | ab <abdullah_ahmed@brown.edu> | 2019-06-12 12:20:34 -0400 |
commit | ce9adde20b611ea8300c402416ef41e4fb960919 (patch) | |
tree | a286a4412cc157252d7e74528b546d4c0d2d6a26 /src/client/util/TooltipTextMenu.tsx | |
parent | 258be09fcfa48f355751cbe99291892018a91ffc (diff) | |
parent | a7cb61db19c3e34dcf3c91152c04d4aea2980682 (diff) |
json stuff
Diffstat (limited to 'src/client/util/TooltipTextMenu.tsx')
-rw-r--r-- | src/client/util/TooltipTextMenu.tsx | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx index 905f1969c..a2288a496 100644 --- a/src/client/util/TooltipTextMenu.tsx +++ b/src/client/util/TooltipTextMenu.tsx @@ -274,21 +274,9 @@ 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({ visibility: false, oldtext: state.selection.content(), oldtextlen: state.selection.to - state.selection.from }); if (dispatch) { - let newNode = type.create(); - newNode.attrs.oldtext = select; + console.log(newNode.attrs.oldtext.toString()); dispatch(state.tr.replaceSelectionWith(newNode)); } return true; |