aboutsummaryrefslogtreecommitdiff
path: root/src/client/views
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-02-20 21:02:17 -0500
committerBob Zeleznik <zzzman@gmail.com>2019-02-20 21:02:17 -0500
commita4c6a84c12aee00340bc20b30fa7d19072d999ba (patch)
tree2d69b900567725e3c09fb85f8a95ca12f7712176 /src/client/views
parentc4a9eed08fbab61c295ec97ca1ffd7048afac3ac (diff)
parentbdc798e6a966e12f574ab47cd46c9cb802aafe74 (diff)
Merge branch 'master' of https://github.com/browngraphicslab/Dash-Web
Diffstat (limited to 'src/client/views')
-rw-r--r--src/client/views/Main.tsx24
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx2
2 files changed, 26 insertions, 0 deletions
diff --git a/src/client/views/Main.tsx b/src/client/views/Main.tsx
index 0e770cd11..2f8337d8e 100644
--- a/src/client/views/Main.tsx
+++ b/src/client/views/Main.tsx
@@ -16,6 +16,7 @@ import { MessageStore, DocumentTransfer } from '../../server/Message';
import { Transform } from '../util/Transform';
import { CollectionDockingView } from './collections/CollectionDockingView';
import { FieldWaiting } from '../../fields/Field';
+import { UndoManager } from '../util/UndoManager';
configure({
@@ -94,6 +95,11 @@ Documents.initProtos(() => {
x: 0, y: 300, width: 200, height: 200, title: "added note"
}));
})
+ let addSchemaNode = action(() => {
+ mainfreeform.GetList<Document>(KeyStore.Data, []).push(Documents.SchemaDocument([Documents.TextDocument()], {
+ x: 0, y: 300, width: 200, height: 200, title: "added note"
+ }));
+ })
let clearDatabase = action(() => {
Utils.Emit(Server.Socket, MessageStore.DeleteAll, {});
@@ -129,10 +135,28 @@ Documents.initProtos(() => {
}} onClick={addColNode}>Add Collection</button>
<button style={{
position: 'absolute',
+ bottom: '100',
+ left: '0px',
+ width: '150px'
+ }} onClick={addSchemaNode}>Add Schema</button>
+ <button style={{
+ position: 'absolute',
bottom: '75px',
left: '0px',
width: '150px'
}} onClick={clearDatabase}>Clear Database</button>
+ <button style={{
+ position: 'absolute',
+ bottom: '25',
+ right: '0px',
+ width: '150px'
+ }} onClick={() => UndoManager.Undo()}>Undo</button>
+ <button style={{
+ position: 'absolute',
+ bottom: '0',
+ right: '0px',
+ width: '150px'
+ }} onClick={() => UndoManager.Redo()}>Redo</button>
</div>),
document.getElementById('root'));
})
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index 412a4d03d..3a66ebb75 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -13,6 +13,7 @@ import { Documents } from "../../documents/Documents";
import { FieldWaiting } from "../../../fields/Field";
import { Transform } from "../../util/Transform";
import { DocumentView } from "../nodes/DocumentView";
+import { undoBatch } from "../../util/UndoManager";
@observer
export class CollectionFreeFormView extends CollectionViewBase {
@@ -37,6 +38,7 @@ export class CollectionFreeFormView extends CollectionViewBase {
@computed
get resizeScaling() { return this.isAnnotationOverlay ? this.props.Document.GetNumber(KeyStore.Width, 0) / this.nativeWidth : 1; }
+ @undoBatch
@action
drop = (e: Event, de: DragManager.DropEvent) => {
const doc: DocumentView = de.data["document"];