From c38cd3c24c254aec3cfad1e7d8c31d8f584e96f0 Mon Sep 17 00:00:00 2001 From: Bob Zeleznik Date: Thu, 9 Apr 2020 11:52:11 -0400 Subject: added initial script template (onClick) for script behaviors --- src/client/documents/Documents.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/client/documents/Documents.ts') diff --git a/src/client/documents/Documents.ts b/src/client/documents/Documents.ts index 5eca71ca9..d07e20b89 100644 --- a/src/client/documents/Documents.ts +++ b/src/client/documents/Documents.ts @@ -509,8 +509,10 @@ export namespace Docs { return InstanceFromProto(Prototypes.get(DocumentType.PRES), initial, options); } - export function ScriptingDocument(options: DocumentOptions = {}) { - return InstanceFromProto(Prototypes.get(DocumentType.SCRIPTING), "", options); + export function ScriptingDocument(script: Opt, options: DocumentOptions = {}, fieldKey?: string) { + const res = InstanceFromProto(Prototypes.get(DocumentType.SCRIPTING), script, options); + fieldKey && res.proto instanceof Doc && ((res.proto as Doc).layout = ScriptingBox.LayoutString(fieldKey)); + return res; } export function VideoDocument(url: string, options: DocumentOptions = {}) { -- cgit v1.2.3-70-g09d2