aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionStackingView.tsx
diff options
context:
space:
mode:
authorbobzel <zzzman@gmail.com>2019-07-11 15:48:19 -0400
committerGitHub <noreply@github.com>2019-07-11 15:48:19 -0400
commitb4350c48aee6474692330761f96f8d93bfd4b2da (patch)
tree2e5048b21a3360faeaf74b6609b58083f496cd88 /src/client/views/collections/CollectionStackingView.tsx
parent7006f67b7cf15734fb0b63d917ae392758704f75 (diff)
parent1b203afbd297f8ae9400a47c9379df912f9ef3b5 (diff)
Merge pull request #201 from browngraphicslab/extensionFields
Extension fields
Diffstat (limited to 'src/client/views/collections/CollectionStackingView.tsx')
-rw-r--r--src/client/views/collections/CollectionStackingView.tsx14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionStackingView.tsx b/src/client/views/collections/CollectionStackingView.tsx
index 372891923..62968821a 100644
--- a/src/client/views/collections/CollectionStackingView.tsx
+++ b/src/client/views/collections/CollectionStackingView.tsx
@@ -14,6 +14,7 @@ import { undoBatch } from "../../util/UndoManager";
import { DragManager } from "../../util/DragManager";
import { DocTypes } from "../../documents/Documents";
import { Transform } from "../../util/Transform";
+import { resolve } from "bluebird";
@observer
export class CollectionStackingView extends CollectionSubView(doc => doc) {
@@ -50,17 +51,18 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
}
overlays = (doc: Doc) => {
- return doc.type === DocTypes.IMG ? { title: "title", caption: "caption" } : {}
+ return doc.type === DocTypes.IMG ? { title: "title", caption: "caption" } : {};
}
getDisplayDoc(layoutDoc: Doc, d: Doc, dxf: () => Transform) {
- let dataDoc = d !== this.props.DataDoc ? this.props.DataDoc : undefined
+ let resolvedDataDoc = !this.props.Document.isTemplate && this.props.DataDoc !== this.props.Document ? this.props.DataDoc : undefined;
+ let dataDoc = d !== this.props.DataDoc ? this.props.DataDoc : undefined;
let width = () => d.nativeWidth ? Math.min(layoutDoc[WidthSym](), this.columnWidth) : this.columnWidth;
let height = () => this.getDocHeight(layoutDoc);
let finalDxf = () => dxf().scale(this.columnWidth / layoutDoc[WidthSym]());
return <CollectionSchemaPreview
Document={layoutDoc}
- DataDocument={dataDoc}
+ DataDocument={resolvedDataDoc}
showOverlays={this.overlays}
renderDepth={this.props.renderDepth}
width={width}
@@ -75,7 +77,7 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
addDocTab={this.props.addDocTab}
setPreviewScript={emptyFunction}
previewScript={undefined}>
- </CollectionSchemaPreview>
+ </CollectionSchemaPreview>;
}
getDocHeight(d: Doc) {
let nw = NumCast(d.nativeWidth);
@@ -176,7 +178,7 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
if (where[0] > pos[0] && where[0] < pos1[0] && where[1] > pos[1] && where[1] < pos1[1]) {
targInd = i;
}
- })
+ });
}
if (super.drop(e, de)) {
let newDoc = de.data.droppedDocuments[0];
@@ -202,7 +204,7 @@ export class CollectionStackingView extends CollectionSubView(doc => doc) {
if (where[0] > pos[0] && where[0] < pos1[0] && where[1] > pos[1] && where[1] < pos1[1]) {
targInd = i;
}
- })
+ });
super.onDrop(e, {}, () => {
if (targInd !== -1) {
let newDoc = this.childDocs[this.childDocs.length - 1];