aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionFreeFormView.tsx
diff options
context:
space:
mode:
authorTyler Schicke <tyler_schicke@brown.edu>2019-02-20 22:02:56 -0500
committerTyler Schicke <tyler_schicke@brown.edu>2019-02-20 22:02:56 -0500
commit7339b4b1f8e9f92160b753dfd3d81faf2887c02f (patch)
tree81275adce0422206ad457566ddfcce16627f67e3 /src/client/views/collections/CollectionFreeFormView.tsx
parent5c147db2e12be2a5aeb57647eda3f4ab43bc697b (diff)
Kind of fixed undo decorator, more work
needed to get it to work with arrow functions
Diffstat (limited to 'src/client/views/collections/CollectionFreeFormView.tsx')
-rw-r--r--src/client/views/collections/CollectionFreeFormView.tsx12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/client/views/collections/CollectionFreeFormView.tsx b/src/client/views/collections/CollectionFreeFormView.tsx
index 3a66ebb75..07e9c0899 100644
--- a/src/client/views/collections/CollectionFreeFormView.tsx
+++ b/src/client/views/collections/CollectionFreeFormView.tsx
@@ -4,7 +4,7 @@ import { action, computed } from "mobx";
import { CollectionFreeFormDocumentView } from "../nodes/CollectionFreeFormDocumentView";
import { DragManager } from "../../util/DragManager";
import "./CollectionFreeFormView.scss";
-import { CollectionViewBase, COLLECTION_BORDER_WIDTH } from "./CollectionViewBase";
+import { CollectionViewBase, COLLECTION_BORDER_WIDTH, CollectionViewProps } from "./CollectionViewBase";
import { KeyStore } from "../../../fields/KeyStore";
import { Document } from "../../../fields/Document";
import { ListField } from "../../../fields/ListField";
@@ -38,9 +38,15 @@ export class CollectionFreeFormView extends CollectionViewBase {
@computed
get resizeScaling() { return this.isAnnotationOverlay ? this.props.Document.GetNumber(KeyStore.Width, 0) / this.nativeWidth : 1; }
- @undoBatch
+ constructor(props: CollectionViewProps) {
+ super(props);
+
+ this.drop = this.drop.bind(this);
+ }
+
@action
- drop = (e: Event, de: DragManager.DropEvent) => {
+ @undoBatch
+ 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);