aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionViewBase.tsx
diff options
context:
space:
mode:
authoryipstanley <stanley_yip@brown.edu>2019-03-17 13:34:10 -0400
committeryipstanley <stanley_yip@brown.edu>2019-03-17 13:34:10 -0400
commitb4dc598ff08c7c684daa4b75508e17213d29d8e5 (patch)
treefc8ba6444a1fc909f5fd9b8de1e8417c83afe0d1 /src/client/views/collections/CollectionViewBase.tsx
parentc739d5ae0f7d78bbd65134606c727df5a71defec (diff)
commitment is difficult
Diffstat (limited to 'src/client/views/collections/CollectionViewBase.tsx')
-rw-r--r--src/client/views/collections/CollectionViewBase.tsx16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/client/views/collections/CollectionViewBase.tsx b/src/client/views/collections/CollectionViewBase.tsx
index f3770056d..a662447cf 100644
--- a/src/client/views/collections/CollectionViewBase.tsx
+++ b/src/client/views/collections/CollectionViewBase.tsx
@@ -3,7 +3,7 @@ import { Document } from "../../../fields/Document";
import { ListField } from "../../../fields/ListField";
import React = require("react");
import { KeyStore } from "../../../fields/KeyStore";
-import { FieldWaiting } from "../../../fields/Field";
+import { FieldWaiting, Field } from "../../../fields/Field";
import { undoBatch } from "../../util/UndoManager";
import { DragManager } from "../../util/DragManager";
import { DocumentView } from "../nodes/DocumentView";
@@ -47,11 +47,23 @@ export class CollectionViewBase extends React.Component<SubCollectionViewProps>
protected drop(e: Event, de: DragManager.DropEvent) {
const docView: DocumentView = de.data["documentView"];
const doc: Document = de.data["document"]
+ if (de.data["alias"]) {
+ let newDoc = docView ? docView.props.Document.CreateAlias() : doc.CreateAlias()
+ de.data["newDoc"] = newDoc
+ let oldDoc = docView ? docView.props.Document : doc
+ oldDoc.GetAsync(KeyStore.Width, (f: Field) => {
+ newDoc.Set(KeyStore.Width, f)
+ })
+ oldDoc.GetAsync(KeyStore.Height, (f: Field) => {
+ newDoc.Set(KeyStore.Height, f)
+ })
+ }
+
if (docView && docView.props.ContainingCollectionView && docView.props.ContainingCollectionView !== this.props.CollectionView) {
if (docView.props.RemoveDocument && !de.data["alias"]) {
docView.props.RemoveDocument(docView.props.Document)
}
- this.props.addDocument(de.data["alias"] ? docView.props.Document.CreateAlias() : docView.props.Document)
+ this.props.addDocument(de.data["alias"] ? de.data["newDoc"] : docView.props.Document)
} else if (doc) {
if (!de.data["alias"]) {
this.props.removeDocument(doc)