mirror of
https://github.com/zadam/trilium.git
synced 2025-01-07 15:49:01 +08:00
fix duplicated cached widgets
This commit is contained in:
parent
81f4966a1a
commit
60d07a6871
3 changed files with 10 additions and 11 deletions
|
@ -44,6 +44,7 @@ app.on('will-quit', () => {
|
||||||
globalShortcut.unregisterAll();
|
globalShortcut.unregisterAll();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// this is to disable electron warning spam in the dev console (local development only)
|
||||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
||||||
|
|
||||||
require('./src/www');
|
require('./src/www');
|
||||||
|
|
|
@ -38,12 +38,6 @@ export default class CalendarWidget extends CollapsibleWidget {
|
||||||
console.log("set tab context", tabContext.tabId, "to", this.componentId);
|
console.log("set tab context", tabContext.tabId, "to", this.componentId);
|
||||||
}
|
}
|
||||||
|
|
||||||
async refresh() {
|
|
||||||
super.refresh();
|
|
||||||
|
|
||||||
//console.trace("tab", this.tabContext.tabId);
|
|
||||||
}
|
|
||||||
|
|
||||||
async doRenderBody() {
|
async doRenderBody() {
|
||||||
await libraryLoader.requireLibrary(libraryLoader.CALENDAR_WIDGET);
|
await libraryLoader.requireLibrary(libraryLoader.CALENDAR_WIDGET);
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,14 @@ export default class TabCachingWidget extends TabAwareWidget {
|
||||||
return this.$widget;
|
return this.$widget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
activeTabChangedListener(param) {
|
||||||
|
super.activeTabChangedListener(param);
|
||||||
|
|
||||||
|
// stop propagation of the event to the children, individual tab widget should not know about tab switching
|
||||||
|
// since they are per-tab
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
refreshWithNote() {
|
refreshWithNote() {
|
||||||
for (const widget of Object.values(this.widgets)) {
|
for (const widget of Object.values(this.widgets)) {
|
||||||
widget.toggle(false);
|
widget.toggle(false);
|
||||||
|
@ -28,17 +36,13 @@ export default class TabCachingWidget extends TabAwareWidget {
|
||||||
|
|
||||||
if (!widget) {
|
if (!widget) {
|
||||||
widget = this.widgets[this.tabContext.tabId] = this.widgetFactory();
|
widget = this.widgets[this.tabContext.tabId] = this.widgetFactory();
|
||||||
this.children.push(widget);
|
this.children.push(widget);console.log("Creating widget",widget.componentId,"for", this.tabContext.tabId);
|
||||||
this.$widget.after(widget.render());
|
this.$widget.after(widget.render());
|
||||||
|
|
||||||
widget.eventReceived('setTabContext', {tabContext: this.tabContext});
|
widget.eventReceived('setTabContext', {tabContext: this.tabContext});
|
||||||
}
|
}
|
||||||
|
|
||||||
widget.toggle(true);
|
widget.toggle(true);
|
||||||
|
|
||||||
// stop propagation of the event to the children, individual tab widget should not know about tab switching
|
|
||||||
// since they are per-tab
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tabRemovedListener({tabId}) {
|
tabRemovedListener({tabId}) {
|
||||||
|
|
Loading…
Reference in a new issue