From 9e18edc6c2b178d9d0960aa95d2b2a9f198ab6d1 Mon Sep 17 00:00:00 2001 From: bob Date: Mon, 13 Jan 2020 16:48:45 -0500 Subject: fixed onChildClick handlers to work for freeform views. added padding for fitTocontents views. fixed performance with templates. added openOnRight script func. switched filter to ||, --- src/new_fields/Doc.ts | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/new_fields') 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 + ")" : ""; } -- cgit v1.2.3-70-g09d2