aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/nodes/FormattedTextBox.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'src/client/views/nodes/FormattedTextBox.tsx')
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx16
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 181f37d36..1bdff3ec7 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -927,16 +927,18 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
onMouseUp = (e: React.MouseEvent): void => {
e.stopPropagation();
- // this interposes on prosemirror's upHandler to prevent prosemirror's up from invoked multiple times when there are nested prosemirrors. We only want the lowest level prosemirror to be invoked.
- if ((this._editorView as any).mouseDown) {
- let originalUpHandler = (this._editorView as any).mouseDown.up;
- (this._editorView as any).root.removeEventListener("mouseup", originalUpHandler);
- (this._editorView as any).mouseDown.up = (e: MouseEvent) => {
+ let view = this._editorView as any;
+ // this interposes on prosemirror's upHandler to prevent prosemirror's up from invoked multiple times when there
+ // are nested prosemirrors. We only want the lowest level prosemirror to be invoked.
+ if (view.mouseDown) {
+ let originalUpHandler = view.mouseDown.up;
+ view.root.removeEventListener("mouseup", originalUpHandler);
+ view.mouseDown.up = (e: MouseEvent) => {
!(e as any).formattedHandled && originalUpHandler(e);
- e.stopPropagation();
+ // e.stopPropagation();
(e as any).formattedHandled = true;
};
- (this._editorView as any).root.addEventListener("mouseup", (this._editorView as any).mouseDown.up);
+ view.root.addEventListener("mouseup", view.mouseDown.up);
}
}