diff options
author | Bob Zeleznik <zzzman@gmail.com> | 2019-08-15 22:36:36 -0400 |
---|---|---|
committer | Bob Zeleznik <zzzman@gmail.com> | 2019-08-15 22:36:36 -0400 |
commit | eb8033aea536e817d49379f50530feca13d0c115 (patch) | |
tree | 3b1ebe6cb38390b9b4485bbe87fb3194c41a06ad /src/client/util/TooltipTextMenu.tsx | |
parent | 5da62eef1dbf9509ac7bce73d927d835d98716d4 (diff) | |
parent | 46386fd73a06e52d606f891c812a9af0598eec79 (diff) |
Merge branch 'master' into monika_ellie_UI
Diffstat (limited to 'src/client/util/TooltipTextMenu.tsx')
-rw-r--r-- | src/client/util/TooltipTextMenu.tsx | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/client/util/TooltipTextMenu.tsx b/src/client/util/TooltipTextMenu.tsx index d33a52d7f..783492d74 100644 --- a/src/client/util/TooltipTextMenu.tsx +++ b/src/client/util/TooltipTextMenu.tsx @@ -67,6 +67,8 @@ export class TooltipTextMenu { @observable private _storedMarks: Mark<any>[] | null | undefined; + public HackToFixTextSelectionGlitch: boolean = false; + constructor(view: EditorView, editorProps: FieldViewProps & FormattedTextBoxProps) { this.view = view; @@ -191,8 +193,6 @@ export class TooltipTextMenu { this.update(view, undefined); - //view.dom.parentNode!.parentNode!.insertBefore(this.tooltip, view.dom.parentNode); - // add tooltip to outerdiv to circumvent scaling problem const outer_div = this.editorProps.outer_div; outer_div && outer_div(this.wrapper); @@ -855,7 +855,8 @@ export class TooltipTextMenu { this.updateFontSizeDropdown("Various"); } } - this.view.dispatch(this.view.state.tr.setStoredMarks(this._activeMarks)); + !this.HackToFixTextSelectionGlitch && + this.view.dispatch(this.view.state.tr.setStoredMarks(this._activeMarks)); // bcz: what's the purpose of this line? It messes up text selection without the Hack. this.update_mark_doms(); } @@ -969,7 +970,7 @@ export class TooltipTextMenu { }); } } - if (!ref_node.isLeaf) { + if (!ref_node.isLeaf && ref_node.childCount > 0) { ref_node = ref_node.child(0); } return ref_node; |