diff options
| author | mehekj <mehek.jethani@gmail.com> | 2023-03-23 15:16:40 -0400 |
|---|---|---|
| committer | mehekj <mehek.jethani@gmail.com> | 2023-03-23 15:16:40 -0400 |
| commit | 5c22004907c210951154017609746e86362c4fb5 (patch) | |
| tree | 108371dccd171c6bd523a01dc3f39a657d85ad96 /src/client/views/nodes/ScriptingBox.tsx | |
| parent | 016e51965ae2d0a83ca2d4e17000d57a40aac264 (diff) | |
| parent | 923f0fdb0f039a923e4e6f870158bd2f2ba32db0 (diff) | |
Merge branch 'master' into schema-mehek
Diffstat (limited to 'src/client/views/nodes/ScriptingBox.tsx')
| -rw-r--r-- | src/client/views/nodes/ScriptingBox.tsx | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/client/views/nodes/ScriptingBox.tsx b/src/client/views/nodes/ScriptingBox.tsx index fa2021642..a6e2c3e90 100644 --- a/src/client/views/nodes/ScriptingBox.tsx +++ b/src/client/views/nodes/ScriptingBox.tsx @@ -180,13 +180,15 @@ export class ScriptingBox extends ViewBoxAnnotatableComponent<ViewBoxAnnotatable const params: ScriptParam = {}; this.compileParams.forEach(p => (params[p.split(':')[0].trim()] = p.split(':')[1].trim())); - const result = CompileScript(this.rawText, { - editable: true, - transformer: DocumentIconContainer.getTransformer(), - params, - typecheck: false, - }); - Doc.SetInPlace(this.rootDoc, this.fieldKey, result.compiled ? new ScriptField(result, undefined, this.rawText) : new ScriptField(undefined, undefined, this.rawText), true); + const result = !this.rawText.trim() + ? ({ compiled: false, errors: undefined } as any) + : CompileScript(this.rawText, { + editable: true, + transformer: DocumentIconContainer.getTransformer(), + params, + typecheck: false, + }); + Doc.SetInPlace(this.rootDoc, this.fieldKey, result.compiled ? new ScriptField(result, undefined, this.rawText) : undefined, true); this.onError(result.compiled ? undefined : result.errors); return result.compiled; }; |
