aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-07-27 17:16:13 -0400
committerTyler Schicke <tyler_schicke@brown.edu>2019-07-27 17:16:13 -0400
commit3b0af6ff470539fd0a25b2ab975195ff9e269b4a (patch)
treef32a84ef59c762a01f378175262abc86598ef38f
parent606e87ccd9c06c83114d5962382cd76def86f103 (diff)
Changed link undoing
-rw-r--r--src/client/util/DragManager.ts1
-rw-r--r--src/client/views/DocumentDecorations.tsx17
2 files changed, 7 insertions, 11 deletions
diff --git a/src/client/util/DragManager.ts b/src/client/util/DragManager.ts
index 95416cd53..a898175b8 100644
--- a/src/client/util/DragManager.ts
+++ b/src/client/util/DragManager.ts
@@ -422,7 +422,6 @@ export namespace DragManager {
if (options) {
options.handlers.dragComplete({});
}
- DocumentDecorations.Instance.endLinkDragBatch();
};
AbortDrag = () => {
diff --git a/src/client/views/DocumentDecorations.tsx b/src/client/views/DocumentDecorations.tsx
index ee16938ff..a34c47fdf 100644
--- a/src/client/views/DocumentDecorations.tsx
+++ b/src/client/views/DocumentDecorations.tsx
@@ -378,16 +378,7 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
}
}
- endLinkDragBatch = () => {
- if (!this._linkDrag) {
- return;
- }
- this._linkDrag.end();
- this._linkDrag = undefined;
- }
-
onLinkerButtonDown = (e: React.PointerEvent): void => {
- this._linkDrag = UndoManager.StartBatch("Drag Link");
e.stopPropagation();
document.removeEventListener("pointermove", this.onLinkerButtonMoved);
document.addEventListener("pointermove", this.onLinkerButtonMoved);
@@ -424,9 +415,15 @@ export class DocumentDecorations extends React.Component<{}, { value: string }>
let container = selDoc.props.ContainingCollectionView ? selDoc.props.ContainingCollectionView.props.Document.proto : undefined;
let dragData = new DragManager.LinkDragData(selDoc.props.Document, container ? [container] : []);
FormattedTextBox.InputBoxOverlay = undefined;
+ this._linkDrag = UndoManager.StartBatch("Drag Link");
DragManager.StartLinkDrag(this._linkerButton.current, dragData, e.pageX, e.pageY, {
handlers: {
- dragComplete: action(emptyFunction),
+ dragComplete: () => {
+ if (this._linkDrag) {
+ this._linkDrag.end();
+ this._linkDrag = undefined;
+ }
+ },
},
hideSource: false
});