aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-04-27 00:42:25 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-04-27 00:42:25 -0400
commita367ba38db64e758e04ee1139a89400113e22bc4 (patch)
treea9fac326bc868ea89cd072003bcfaa27fd9f967c
parente2bb0381150aa62c041f3fc6beb0a7b0fed7b58e (diff)
undo for golden layout that's still not working.
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index 3267f2455..2a8191c3a 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -10,7 +10,7 @@ import Measure from "react-measure";
import { FieldId, Opt, Field, FieldWaiting } from "../../../fields/Field";
import { Utils, returnTrue, emptyFunction, emptyDocFunction, returnOne, returnZero } from "../../../Utils";
import { Server } from "../../Server";
-import { undoBatch } from "../../util/UndoManager";
+import { undoBatch, UndoManager } from "../../util/UndoManager";
import { DocumentView } from "../nodes/DocumentView";
import "./CollectionDockingView.scss";
import React = require("react");
@@ -48,7 +48,11 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
(window as any).React = React;
(window as any).ReactDOM = ReactDOM;
}
+ hack: boolean = false;
+ undohack: any = null;
public StartOtherDrag(dragDocs: Document[], e: any) {
+ this.hack = true;
+ this.undohack = UndoManager.StartBatch("goldenDrag");
dragDocs.map(dragDoc =>
this.AddRightSplit(dragDoc, true).contentItems[0].tab._dragListener.
onMouseDown({ pageX: e.pageX, pageY: e.pageY, preventDefault: emptyFunction, button: 0 }));
@@ -236,6 +240,11 @@ export class CollectionDockingView extends React.Component<SubCollectionViewProp
stateChanged = () => {
var json = JSON.stringify(this._goldenLayout.toConfig());
this.props.Document.SetText(KeyStore.Data, json);
+ if (this.undohack && !this.hack) {
+ this.undohack.end();
+ this.undohack = undefined;
+ }
+ this.hack = false;
}
itemDropped = () => {