diff --git a/abstract/Block.js b/abstract/Block.js index ef5df9694..9aeb18e29 100644 --- a/abstract/Block.js +++ b/abstract/Block.js @@ -227,6 +227,14 @@ export class Block extends BaseComponent { let o = Object.create(null); /** @private */ this.__cfgProxy = new Proxy(o, { + set: (obj, key, value) => { + if (typeof key !== 'string') { + return false; + } + const sharedKey = sharedConfigKey(/** @type {keyof import('../types').ConfigType} */ (key)); + this.$[sharedKey] = value; + return true; + }, /** * @param {never} obj * @param {keyof import('../types').ConfigType} key diff --git a/blocks/Config/Config.js b/blocks/Config/Config.js index 4841dad02..8ca9c7169 100644 --- a/blocks/Config/Config.js +++ b/blocks/Config/Config.js @@ -59,9 +59,21 @@ export class Config extends Block { initCallback() { super.initCallback(); + const anyThis = /** @type {typeof this & any} */ (this); + + for (const key of plainConfigKeys) { + this.sub( + sharedConfigKey(key), + (value) => { + if (value !== initialConfig[key]) { + anyThis[key] = value; + } + }, + false + ); + } for (const key of allConfigKeys) { - const anyThis = /** @type {typeof this & any} */ (this); let localPropName = '__' + key; anyThis[localPropName] = anyThis[key]; diff --git a/blocks/test/raw-minimal.htm b/blocks/test/raw-minimal.htm index 35b799c7a..ea0350abd 100644 --- a/blocks/test/raw-minimal.htm +++ b/blocks/test/raw-minimal.htm @@ -3,16 +3,6 @@
-