From 693e0b3f7ea91b4d878ff2333a925bd07abfc260 Mon Sep 17 00:00:00 2001 From: nd0ut Date: Fri, 20 Oct 2023 16:31:27 +0300 Subject: [PATCH] fix(minimal-mode): add file button should open system dialog --- abstract/Block.js | 8 ++++++++ blocks/Config/Config.js | 14 +++++++++++++- blocks/test/raw-minimal.htm | 14 +++----------- 3 files changed, 24 insertions(+), 12 deletions(-) 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 @@ -