From 0b12ca7a6a999cf3a0b130567b4f1354e3ea785b Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Sun, 17 May 2020 12:40:46 -0500 Subject: adjusting parameters reduce --- src/client/views/nodes/ScriptingBox.tsx | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) (limited to 'src/client/views/nodes/ScriptingBox.tsx') diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index ec11ad346..b507d250b 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -75,7 +75,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent e.messageText).join("\n") : ""; // return this.dataDoc[this.props.fieldKey] = result.compiled ? new ScriptField(result) : undefined; - const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam); + const params = this.compileParams.reduce((o: ScriptParam, p: string) => { + const param = p.split("="); + o[param[0]] = param[1]; + return o; + }, + {} as ScriptParam); console.log(this.compileParams); @@ -98,7 +103,13 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { - const params = this.compileParams.reduce((o: ScriptParam, p: string) => { o[p] = "any"; return o; }, {} as ScriptParam); + const params = this.compileParams.reduce((o: ScriptParam, p: string) => { + const param = p.split("="); + o[param[0]] = param[1]; + return o; + }, + {} as ScriptParam); + const result = CompileScript(this.rawScript, { editable: true, transformer: DocumentIconContainer.getTransformer(), @@ -134,7 +145,7 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent(value.split(";").filter(s => s !== " ")); - //this._parameters.push(this.compileParams); this.compileParams.push.apply(this.compileParams, par); console.log(this.compileParams); return true; @@ -188,7 +198,6 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { if (value !== "" && value !== " ") { this.compileParams[i] = value; - //this._parameters[i] = value; parameter = value; return true; } else { -- cgit v1.2.3-70-g09d2