From bef96415c2bd98ffa6527545ddae3ebafda9511f Mon Sep 17 00:00:00 2001 From: Sipke Schoorstra Date: Tue, 11 Jan 2022 13:53:42 +0100 Subject: [PATCH] Remove option to edit "source" literal for now --- .../input-control-switch/input-control-switch.tsx | 12 ++++++++---- .../src/components/inputs/single-line.tsx | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/src/designer/elsa-workflows-designer/src/components/designer/input-control-switch/input-control-switch.tsx b/src/designer/elsa-workflows-designer/src/components/designer/input-control-switch/input-control-switch.tsx index b2256f360..ec0ad02a7 100644 --- a/src/designer/elsa-workflows-designer/src/components/designer/input-control-switch/input-control-switch.tsx +++ b/src/designer/elsa-workflows-designer/src/components/designer/input-control-switch/input-control-switch.tsx @@ -111,14 +111,19 @@ export class InputControlSwitch { ; } - private renderContextMenuButton = () => this.syntax ? {this.syntax} : ; + private renderContextMenuButton = () => { + const selectedSyntax = this.syntax; + const showMonaco = !!selectedSyntax && selectedSyntax != 'Literal'; + return showMonaco ? {this.syntax} : ; + }; private renderEditor = () => { const selectedSyntax = this.syntax; const monacoLanguage = this.mapSyntaxToLanguage(selectedSyntax); const value = this.expression; - const expressionEditorClass = selectedSyntax ? 'block' : 'hidden'; - const defaultEditorClass = selectedSyntax ? 'hidden' : 'block'; + const showMonaco = !!selectedSyntax && selectedSyntax != 'Literal'; + const expressionEditorClass = showMonaco ? 'block' : 'hidden'; + const defaultEditorClass = showMonaco ? 'hidden' : 'block'; return (
@@ -147,7 +152,6 @@ export class InputControlSwitch { return 'javascript'; case 'Liquid': return 'handlebars'; - case 'Literal': default: return 'plaintext'; } diff --git a/src/designer/elsa-workflows-designer/src/components/inputs/single-line.tsx b/src/designer/elsa-workflows-designer/src/components/inputs/single-line.tsx index 4de6150d3..39504e641 100644 --- a/src/designer/elsa-workflows-designer/src/components/inputs/single-line.tsx +++ b/src/designer/elsa-workflows-designer/src/components/inputs/single-line.tsx @@ -21,7 +21,7 @@ export class SingleLineInput { const input = getInputPropertyValue(inputContext); const value = (input?.expression as LiteralExpression)?.value; // TODO: The "value" field is currently hardcoded, but we should be able to be more flexible and potentially have different fields for a given syntax. const syntax = input?.expression?.type ?? inputDescriptor.defaultSyntax; - const supportedSyntaxes = ['Literal', 'JavaScript', 'Liquid']; + const supportedSyntaxes = ['JavaScript', 'Liquid']; return (