aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2019-05-01 09:03:17 -0400
committerbob <bcz@cs.brown.edu>2019-05-01 09:03:17 -0400
commit8f9baace2a0fd25e8a1cbdbb153cee1f286ad8e3 (patch)
tree383ca161ecb7a79bbfb65c68b421cd55714e71ee /src
parent5d1a60b3df65b801de504c3d7b08d6a1fc9ef03b (diff)
fixed transition to GoldenLayout with Shift after drag starts
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DocumentView.tsx1
-rw-r--r--src/client/views/nodes/FormattedTextBox.tsx6
2 files changed, 6 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index eab068355..cda9f9473 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -171,7 +171,6 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
document.addEventListener("pointermove", this.onPointerMove);
document.removeEventListener("pointerup", this.onPointerUp);
document.addEventListener("pointerup", this.onPointerUp);
- e.preventDefault();
}
}
onPointerMove = (e: PointerEvent): void => {
diff --git a/src/client/views/nodes/FormattedTextBox.tsx b/src/client/views/nodes/FormattedTextBox.tsx
index 45e5901eb..12b7b5abf 100644
--- a/src/client/views/nodes/FormattedTextBox.tsx
+++ b/src/client/views/nodes/FormattedTextBox.tsx
@@ -237,6 +237,11 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
onClick = (e: React.MouseEvent): void => {
this._proseRef.current!.focus();
}
+ onMouseDown = (e: React.MouseEvent): void => {
+ if (!this.props.isSelected() && this.props.active()) { // preventing default allows the onClick to be generated instead of being swallowed by the text box itself
+ e.preventDefault(); // bcz: this would normally be in OnPointerDown - however, if done there, no mouse move events will be generated which makes transititioning to GoldenLayout's drag interactions impossible
+ }
+ }
tooltipTextMenuPlugin() {
let myprops = this.props;
@@ -290,6 +295,7 @@ export class FormattedTextBox extends DocComponent<(FieldViewProps & FormattedTe
onClick={this.onClick}
onPointerUp={this.onPointerUp}
onPointerDown={this.onPointerDown}
+ onMouseDown={this.onMouseDown}
onContextMenu={this.specificContextMenu}
// tfs: do we need this event handler
onWheel={this.onPointerWheel}