aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBob Zeleznik <zzzman@gmail.com>2020-03-29 19:14:00 -0400
committerBob Zeleznik <zzzman@gmail.com>2020-03-29 19:14:00 -0400
commitd9508fdc37e38eb62ef2b0aff76a9b5964f0f7a1 (patch)
treeeab6eaaf82a24ebd004d09b58c86d4ee2a0fd27f /src
parentf1ee7b622c3acc654d19bcf8d306f15f8e087a76 (diff)
added 'self' scripting parameter to always point to the source unexpanded document of a template expansion chain
Diffstat (limited to 'src')
-rw-r--r--src/client/views/nodes/DocumentView.tsx3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/client/views/nodes/DocumentView.tsx b/src/client/views/nodes/DocumentView.tsx
index 4968dd7fc..63e3e0431 100644
--- a/src/client/views/nodes/DocumentView.tsx
+++ b/src/client/views/nodes/DocumentView.tsx
@@ -290,7 +290,8 @@ export class DocumentView extends DocComponent<DocumentViewProps, Document>(Docu
} else if (this.onClickHandler?.script) {
SelectionManager.DeselectAll();
UndoManager.RunInBatch(() => this.onClickHandler!.script.run({
- this: this.Document.isTemplateForField && this.props.DataDoc ? this.props.DataDoc : this.props.Document, // try this.props.Document.expandedTemplate || this.props.Document
+ this: this.props.Document,
+ self: Cast(this.props.Document.expandedTemplate, Doc, null) || this.props.Document,
containingCollection: this.props.ContainingCollectionDoc, shiftKey: e.shiftKey
}, console.log) && !this.props.Document.dontSelect && !this.props.Document.isButton && this.select(false), "on click");
} else if (this.Document.type === DocumentType.BUTTON) {