aboutsummaryrefslogtreecommitdiff
path: root/src/client/views/collections/CollectionSubView.tsx
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2019-10-20 13:34:25 -0400
committerBob Zeleznik <zzzman@gmail.com>2019-10-20 13:34:25 -0400
commitd8f12dade0d0b336e4328fa1f00a1a538588d34e (patch)
treeae33d9664209cc46ecf43dcdacd11f423ae29029 /src/client/views/collections/CollectionSubView.tsx
parent9afcb0f8ab12bd94494b7a5b532dbe26835382ac (diff)
initial version of template refactoring
Diffstat (limited to 'src/client/views/collections/CollectionSubView.tsx')
-rw-r--r--src/client/views/collections/CollectionSubView.tsx11
1 files changed, 5 insertions, 6 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index f76447157..0e8c46d40 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -61,11 +61,11 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
this._childLayoutDisposer = reaction(() => [this.childDocs, Cast(this.props.Document.childLayout, Doc)],
async (args) => {
if (args[1] instanceof Doc) {
- this.childDocs.map(async doc => !Doc.AreProtosEqual(args[1] as Doc, (await doc).layout as Doc) && Doc.ApplyTemplateTo(args[1] as Doc, (await doc)));
+ this.childDocs.map(async doc => !Doc.AreProtosEqual(args[1] as Doc, (await doc).layout as Doc) && Doc.ApplyTemplateTo(args[1] as Doc, (await doc), "layoutFromParent"));
+ }
+ else if (!(args[1] instanceof Promise)) {
+ this.childDocs.filter(d => !d.isTemplateField).map(async doc => doc.layoutKey === "layoutFromParent" && (doc.layoutKey = "layout"));
}
- // else if (!(args[1] instanceof Promise)) {
- // this.childDocs.filter(d => !d.isTemplateField).map(async doc => doc.layout = undefined);
- // }
});
}
@@ -134,8 +134,7 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
if (de.data instanceof DragManager.DocumentDragData && !de.data.applyAsTemplate) {
if (de.mods === "AltKey" && de.data.draggedDocuments.length) {
this.childDocs.map(doc =>
- Doc.ApplyTemplateTo(de.data.draggedDocuments[0], doc)
- );
+ Doc.ApplyTemplateTo(de.data.draggedDocuments[0], doc, "layoutFromParent"));
e.stopPropagation();
return true;
}