From 39b600c294e3e01daf4dfd902193c0af8535976e Mon Sep 17 00:00:00 2001 From: anika-ahluwalia Date: Sun, 17 May 2020 16:27:53 -0500 Subject: parameters are identified by types now --- src/client/views/nodes/ScriptingBox.tsx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 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 d274398b5..7ffb0802a 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -77,7 +77,8 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { - const param = p.split("="); + const param = p.split(":"); + o[param[0].trim()] = param[1].trim(); return o; }, @@ -105,8 +106,8 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { const params = this.compileParams.reduce((o: ScriptParam, p: string) => { - const param = p.split("="); - o[param[0]] = param[1]; + const param = p.split(":"); + o[param[0].trim()] = param[1].trim(); return o; }, {} as ScriptParam); @@ -142,11 +143,12 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent { this._dropped = true; console.log("drop"); - const firstParam = this.compileParams[index].split("="); + const firstParam = this.compileParams[index].split(":"); const droppedDocs = de.complete.docDragData?.droppedDocuments; if (droppedDocs?.length) { const dropped = droppedDocs[0]; - this.compileParams[index] = firstParam[0] + " = " + Doc.name; // you can't just bind a variable to a specific Doc. The Doc would have to be added to 'capturedVariables' field of the compile options, but I think it makes more sense to just be declaring this variable to be a Doc + this.compileParams[index] = firstParam[0] + ":" + Doc.name; + // you can't just bind a variable to a specific Doc. The Doc would have to be added to 'capturedVariables' field of the compile options, but I think it makes more sense to just be declaring this variable to be a Doc } } @@ -170,7 +172,6 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent(value.split(";").filter(s => s !== " ")); this.compileParams.push.apply(this.compileParams, par); - console.log(this.compileParams); return true; } return false; -- cgit v1.2.3-70-g09d2