Theming API: update mergeKeys method for presets

This commit is contained in:
mertsincan 2024-04-15 11:21:03 +01:00
parent 51110b585a
commit 9bdabd8530
4 changed files with 22 additions and 5 deletions

View file

@ -49,6 +49,9 @@ export default {
handler(newValue) {
if (newValue) {
this._loadScopedThemeStyles(newValue);
this._themeChangeListener(() => this._loadScopedThemeStyles(newValue));
} else {
this._unloadScopedThemeStyles();
}
}
}
@ -91,7 +94,7 @@ export default {
this._hook('onBeforeUnmount');
},
unmounted() {
this.scopedStyleEl?.value?.remove();
this._unloadScopedThemeStyles();
this._hook('onUnmounted');
},
methods: {
@ -185,6 +188,9 @@ export default {
this.scopedStyleEl = scopedStyle.el;
},
_unloadScopedThemeStyles() {
this.scopedStyleEl?.value?.remove();
},
_themeChangeListener(callback = () => {}) {
Base.clearLoadedStyleNames();
ThemeService.on('theme:change', callback);