aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/client/views/collections/CollectionSubView.tsx11
-rw-r--r--src/new_fields/util.ts12
2 files changed, 18 insertions, 5 deletions
diff --git a/src/client/views/collections/CollectionSubView.tsx b/src/client/views/collections/CollectionSubView.tsx
index 9482435a0..0eeb1c83d 100644
--- a/src/client/views/collections/CollectionSubView.tsx
+++ b/src/client/views/collections/CollectionSubView.tsx
@@ -70,7 +70,10 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
(args) => {
const childLayout = Cast(this.props.Document.childLayout, Doc);
if (childLayout instanceof Doc) {
- this.childDocs.map(doc => Doc.ApplyTemplateTo(childLayout, doc, "layout_fromParent"));
+ this.childDocs.map(doc => {
+ doc.layout_fromParent = childLayout;
+ doc.layoutKey = "layout_fromParent";
+ });
}
else if (!(childLayout instanceof Promise)) {
this.childDocs.filter(d => !d.isTemplateForField).map(doc => doc.layoutKey === "layout_fromParent" && (doc.layoutKey = "layout"));
@@ -182,8 +185,10 @@ export function CollectionSubView<T>(schemaCtor: (doc: Doc) => T) {
this.props.Document.dropConverter.script.run({ dragData: docDragData }); /// bcz: check this
if (docDragData && !docDragData.applyAsTemplate) {
if (de.altKey && docDragData.draggedDocuments.length) {
- this.childDocs.map(doc =>
- Doc.ApplyTemplateTo(docDragData.draggedDocuments[0], doc, "layout_fromParent"));
+ this.childDocs.map(doc => {
+ doc.layout_fromParent = docDragData.draggedDocuments[0];
+ doc.layoutKey = "layout_fromParent";
+ });
e.stopPropagation();
return true;
}
diff --git a/src/new_fields/util.ts b/src/new_fields/util.ts
index 19ca8a7ee..2768f1213 100644
--- a/src/new_fields/util.ts
+++ b/src/new_fields/util.ts
@@ -112,7 +112,11 @@ export function setter(target: any, in_prop: string | symbol | number, value: an
}
const resolvedLayout = getFieldImpl(target, getFieldImpl(target, "layoutKey", receiver), receiver);
if (resolvedLayout instanceof Doc) {
- resolvedLayout[prop] = value;
+ let x = resolvedLayout[Id];
+ let layout = (resolvedLayout.layout as string).split("'")[1];
+ let expanded = getFieldImpl(target, layout + "-layout[" + x + "]", receiver);
+ expanded && (expanded[prop] = value);
+ // resolvedLayout[prop] = value;
return true;
}
}
@@ -129,7 +133,11 @@ export function getter(target: any, in_prop: string | symbol | number, receiver:
}
const resolvedLayout = getFieldImpl(target, getFieldImpl(target, "layoutKey", receiver), receiver);
if (resolvedLayout instanceof Doc) {
- return resolvedLayout[prop];
+ let x = resolvedLayout[Id];
+ let layout = (resolvedLayout.layout as string).split("'")[1];
+ let expanded = getFieldImpl(target, layout + "-layout[" + x + "]", receiver);
+ return expanded?.[prop];
+ //return resolvedLayout[prop];
}
}
if (prop === "then") {//If we're being awaited