aboutsummaryrefslogtreecommitdiff
path: root/src/new_fields/Doc.ts
diff options
context:
space:
mode:
authorbob <bcz@cs.brown.edu>2020-01-13 16:48:45 -0500
committerbob <bcz@cs.brown.edu>2020-01-13 16:48:45 -0500
commit9e18edc6c2b178d9d0960aa95d2b2a9f198ab6d1 (patch)
tree6edfde1a9b4121fb8281f587444110dd45cd3c64 /src/new_fields/Doc.ts
parent9955ff8c2de58cfe37e02d6a356b5a8a2930bb05 (diff)
fixed onChildClick handlers to work for freeform views. added padding for fitTocontents views. fixed performance with templates. added openOnRight script func. switched filter to ||,
Diffstat (limited to 'src/new_fields/Doc.ts')
-rw-r--r--src/new_fields/Doc.ts14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/new_fields/Doc.ts b/src/new_fields/Doc.ts
index 32ab36c0f..c809ad17a 100644
--- a/src/new_fields/Doc.ts
+++ b/src/new_fields/Doc.ts
@@ -572,13 +572,15 @@ export namespace Doc {
return;
}
- const layoutCustomLayout = Doc.MakeDelegate(templateDoc);
+ if ((target[targetKey] as Doc)?.proto !== templateDoc) {
+ const layoutCustomLayout = Doc.MakeDelegate(templateDoc);
- titleTarget && (Doc.GetProto(target).title = titleTarget);
- Doc.GetProto(target).type = DocumentType.TEMPLATE;
- target.onClick = templateDoc.onClick instanceof ObjectField && templateDoc.onClick[Copy]();
+ titleTarget && (Doc.GetProto(target).title = titleTarget);
+ Doc.GetProto(target).type = DocumentType.TEMPLATE;
+ target.onClick = templateDoc.onClick instanceof ObjectField && templateDoc.onClick[Copy]();
- Doc.GetProto(target)[targetKey] = layoutCustomLayout;
+ Doc.GetProto(target)[targetKey] = layoutCustomLayout;
+ }
target.layoutKey = targetKey;
return target;
}
@@ -750,7 +752,7 @@ export namespace Doc {
const value = docFilters[i + 1];
const modifiers = docFilters[i + 2];
const scriptText = `${modifiers === "x" ? "!" : ""}matchFieldValue(doc, "${key}", "${value}")`;
- docFilterText = docFilterText ? docFilterText + " && " + scriptText : scriptText;
+ docFilterText = docFilterText ? docFilterText + " || " + scriptText : scriptText;
};
return docFilterText ? "(" + docFilterText + ")" : "";
}