From 8e56ee4c6f1f16402edd8abee9daa55678117466 Mon Sep 17 00:00:00 2001 From: bob Date: Thu, 21 Feb 2019 13:44:58 -0500 Subject: everything works. --- src/client/util/UndoManager.ts | 2 +- src/client/views/Main.tsx | 2 +- src/client/views/collections/CollectionDockingView.tsx | 2 ++ src/client/views/collections/CollectionFreeFormView.tsx | 6 ++---- 4 files changed, 6 insertions(+), 6 deletions(-) (limited to 'src') 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 { +export function undoBatch(target: any, key: string | symbol, descriptor?: TypedPropertyDescriptor): 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); -- cgit v1.2.3-70-g09d2