aboutsummaryrefslogtreecommitdiff
path: root/src/client/util/TooltipTextMenu.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/util/TooltipTextMenu.tsx')
-rw-r--r--src/client/util/TooltipTextMenu.tsx9
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;