fix: reinitialize settings tabs for DOM events

This commit is contained in:
KernelDeimos 2024-11-04 19:25:04 -05:00
parent 856688f884
commit 16b9f09e66
3 changed files with 15 additions and 1 deletions

View File

@ -110,6 +110,9 @@ async function UIWindowSettings(options){
const component = tab.factory();
component.attach(tab_placeholders[i]);
}
if ( tab.reinitialize ) {
tab.reinitialize();
}
if ( tab.dom ) {
tab_placeholders[i].replaceWith(tab.dom);
}

View File

@ -93,6 +93,12 @@ export default def(class UIElement extends AdvancedBase {
this.make(this);
}
reinitialize () {
this.root = document.createElement(this.tagName);
this.make(this);
return this.root;
}
async open_as_window (options = {}) {
const placeholder = Placeholder();
console.log('window options?', this.windowOptions);

View File

@ -49,7 +49,12 @@ export class SettingsService extends Service {
const ui_element = tab;
tab = {
...ui_element.as(TSettingsTab).get_metadata(),
dom: ui_element.root,
reinitialize () {
ui_element.reinitialize();
},
get dom () {
return ui_element.root;
},
};
}
this.#tabs.push(tab);