aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/client/util/UndoManager.ts2
-rw-r--r--src/client/views/Main.tsx2
-rw-r--r--src/client/views/collections/CollectionDockingView.tsx2
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx6
4 files changed, 6 insertions, 6 deletions
diff --git a/src/client/util/UndoManager.ts b/src/client/util/UndoManager.ts
index 8e9e11a11..edb75b55f 100644
--- a/src/client/util/UndoManager.ts
+++ b/src/client/util/UndoManager.ts
@@ -25,7 +25,7 @@ function propertyDecorator(target: any, key: string | symbol) {
}
})
}
-export function undoBatch(target: any, key: string | symbol, descriptor: TypedPropertyDescriptor<any>): any {
+export function undoBatch(target: any, key: string | symbol, descriptor?: TypedPropertyDescriptor<any>): any {
if (!descriptor) {
propertyDecorator(target, key);
return;
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index f35362fd4..c7a6a44e8 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -76,7 +76,7 @@ Documents.initProtos(() => {
var docs = [mainfreeform].map(doc => CollectionDockingView.makeDocumentConfig(doc));
mainContainer.SetText(KeyStore.Data, JSON.stringify({ content: [{ type: 'row', content: docs }] }));
mainContainer.Set(KeyStore.ActiveFrame, mainfreeform);
- }, 25);
+ }, 0);
}
let addImageNode = action(() => {
diff --git a/src/client/views/collections/CollectionDockingView.tsx b/src/client/views/collections/CollectionDockingView.tsx
index e8a1eaf92..35b130a9a 100644
--- a/src/client/views/collections/CollectionDockingView.tsx
+++ b/src/client/views/collections/CollectionDockingView.tsx
@@ -16,6 +16,7 @@ import { Server } from "../../Server";
import { observer } from "mobx-react";
import { KeyStore } from "../../../fields/KeyStore";
import { Opt } from "../../../fields/Field";
+import { undoBatch } from "../../util/UndoManager";
@observer
export class CollectionDockingView extends CollectionViewBase {
@@ -201,6 +202,7 @@ export class CollectionDockingView extends CollectionViewBase {
}
}
+ @undoBatch
stateChanged = () => {
var json = JSON.stringify(this._goldenLayout.toConfig());
this.props.Document.SetText(KeyStore.Data, json)
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index 07e9c0899..986bcdcee 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -40,13 +40,11 @@ export class CollectionFreeFormView extends CollectionViewBase {
constructor(props: CollectionViewProps) {
super(props);
-
- this.drop = this.drop.bind(this);
}
- @action
@undoBatch
- drop(e: Event, de: DragManager.DropEvent) {
+ @action
+ drop = (e: Event, de: DragManager.DropEvent) => {
const doc: DocumentView = de.data["document"];
if (doc.props.ContainingCollectionView && doc.props.ContainingCollectionView !== this) {
doc.props.ContainingCollectionView.removeDocument(doc.props.Document);