From 8f6344fbd54f0c966e7ea20dbd2f6a2ab11eb95b Mon Sep 17 00:00:00 2001 From: Jan Oberhauser Date: Mon, 31 May 2021 12:59:45 -0500 Subject: [PATCH] :bug: Fix issue with selecting variables in Expression Editor --- packages/editor-ui/src/components/ExpressionEdit.vue | 10 ++++++++-- packages/editor-ui/src/components/ExpressionInput.vue | 10 ++++++---- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/editor-ui/src/components/ExpressionEdit.vue b/packages/editor-ui/src/components/ExpressionEdit.vue index e08bc63f17..fe5e5f4482 100644 --- a/packages/editor-ui/src/components/ExpressionEdit.vue +++ b/packages/editor-ui/src/components/ExpressionEdit.vue @@ -73,9 +73,15 @@ export default mixins( }; }, methods: { - valueChanged (value: string) { + valueChanged (value: string, forceUpdate = false) { this.latestValue = value; - this.callDebounced('updateDisplayValue', 500); + + if (forceUpdate === true) { + this.updateDisplayValue(); + this.$emit('valueChanged', this.latestValue); + } else { + this.callDebounced('updateDisplayValue', 500); + } }, updateDisplayValue () { diff --git a/packages/editor-ui/src/components/ExpressionInput.vue b/packages/editor-ui/src/components/ExpressionInput.vue index a42ff6613b..b5b7a2c84c 100644 --- a/packages/editor-ui/src/components/ExpressionInput.vue +++ b/packages/editor-ui/src/components/ExpressionInput.vue @@ -234,11 +234,13 @@ export default mixins( } else { // If no position got found add it to end let newValue = this.value; - if (newValue !== '=') { - newValue += ` `; + if (newValue === '=' || newValue === '=0') { + newValue = `{{${eventData.variable}}}\n`; + } else { + newValue += ` {{${eventData.variable}}}\n`; } - newValue += `{{${eventData.variable}}}\n`; - this.$emit('change', newValue); + + this.$emit('change', newValue, true); if (!this.resolvedValue) { Vue.nextTick(() => { this.initValue();