From 60621203e5894a5617c6fba7127ef97ff2c97eb3 Mon Sep 17 00:00:00 2001 From: jean-emmanuel Date: Thu, 6 May 2021 14:27:31 +0200 Subject: [PATCH] advanced syntaxes: `VAR{}` not updating when the default value is edited --- CHANGELOG.md | 8 +++++++- src/client/widgets/common/widget.js | 10 ++++++++++ src/client/widgets/scripts/script-vm.js | 2 ++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 73330b85..e41241d6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,11 +1,17 @@ # Changelog +## 1.9.6 + +- bug fixes + - advanced syntaxes: `VAR{}` not updating when the default value is edited + - editor: fix "Bring to front" and "Send to back" context menu actions + + ## 1.9.5 - bug fixes - advanced syntaxes: various isses and regressions - editor: preserve advanced syntaxes in `left` and `top` when pasting a widget - - editor: fix "Bring to front" and "Send to back" context menu actions - editor - tree: update widget visibility when it changes dynamically diff --git a/src/client/widgets/common/widget.js b/src/client/widgets/common/widget.js index c75105df..a4fe4598 100644 --- a/src/client/widgets/common/widget.js +++ b/src/client/widgets/common/widget.js @@ -649,6 +649,16 @@ class Widget extends EventEmitter { } + // update value if default changed + if ( + value !== undefined && + !this.variables[name].updated && // only true on edit + value !== this.variables[name].default + ) { + this.variables[name].default = value + this.variables[name].value = value + } + var r = this.variables[name].value var varname = 'VAR_' + varnumber diff --git a/src/client/widgets/scripts/script-vm.js b/src/client/widgets/scripts/script-vm.js index 12a31e92..3164abba 100644 --- a/src/client/widgets/scripts/script-vm.js +++ b/src/client/widgets/scripts/script-vm.js @@ -111,7 +111,9 @@ class ScriptVm extends Vm { if (widgets[i].variables[name]) { widgets[i].variables[name].value = value + widgets[i].variables[name].updated = 1 widgets[i].updateProps(widgets[i].variables[name].propNames) + widgets[i].variables[name].updated = 0 } else {