widgets: prevent value-stateless widgets (tap buttons, clone, scripts, html and svg) from sending a value for cross-client synchronization (leads to unexpected script execution) and exclude them from state saves

This commit is contained in:
bordun 2020-11-26 11:13:57 +01:00
parent b3c10f1885
commit 2e9514cb88
7 changed files with 13 additions and 4 deletions

View file

@ -35,7 +35,7 @@ var StateManager = class StateManager {
if (filter && !filter(widget)) continue
if (widget.setValue && widget.getValue) {
if (widget.setValue && widget.getValue && !widget.noValueState) {
var v = widget.getValue()
@ -83,7 +83,7 @@ var StateManager = class StateManager {
var widget = widgetManager.widgets[i]
if (widget.sendValue) {
if (widget.sendValue && !widget.noValueState) {
widget.sendValue(null, options)
}
}

View file

@ -132,7 +132,7 @@ class Button extends Widget {
}
if (tap) this.noValueState = true
this.value = this.getProp('off')

View file

@ -41,6 +41,8 @@ class Clone extends Container() {
super({...options, html: html`<div class="clone"></div>`})
this.noValueState = true
this.cloneLock = false
this.cloneTarget = null
this.cloneClass = []

View file

@ -42,6 +42,8 @@ class Html extends StaticProperties(Widget, {bypass: true}) {
</inner>
`})
this.noValueState = true
if (!this.getProp('border')) this.container.classList.add('noborder')
this.frame = DOM.get(this.widget, '.frame')[0]

View file

@ -38,6 +38,8 @@ class Svg extends StaticProperties(Widget, {bypass: true}) {
</inner>
`})
this.noValueState = true
this.frame = DOM.get(this.widget, '.frame')[0]
this.height = undefined

View file

@ -42,6 +42,8 @@ class Script extends Widget {
super({...options, html: null})
this.noValueState = true
this.builtIn = options.builtIn
this.scriptLock = false