mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
fix new tab open hiding
This commit is contained in:
parent
687a466a35
commit
2cc0442ef2
926
package-lock.json
generated
926
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
14
package.json
14
package.json
@ -25,7 +25,7 @@
|
||||
"body-parser": "1.19.0",
|
||||
"cls-hooked": "4.2.2",
|
||||
"commonmark": "0.29.1",
|
||||
"cookie-parser": "1.4.4",
|
||||
"cookie-parser": "1.4.5",
|
||||
"csurf": "1.11.0",
|
||||
"dayjs": "1.8.22",
|
||||
"debug": "4.1.1",
|
||||
@ -36,7 +36,7 @@
|
||||
"electron-window-state": "5.0.3",
|
||||
"express": "4.17.1",
|
||||
"express-session": "1.17.0",
|
||||
"file-type": "14.1.3",
|
||||
"file-type": "14.1.4",
|
||||
"fs-extra": "8.1.0",
|
||||
"helmet": "3.21.3",
|
||||
"html": "1.0.0",
|
||||
@ -56,7 +56,7 @@
|
||||
"open": "7.0.3",
|
||||
"portscanner": "2.2.0",
|
||||
"rand-token": "0.4.0",
|
||||
"rcedit": "2.1.0",
|
||||
"rcedit": "2.1.1",
|
||||
"rimraf": "3.0.2",
|
||||
"sanitize-filename": "1.6.3",
|
||||
"sax": "1.2.4",
|
||||
@ -67,17 +67,17 @@
|
||||
"sqlite": "3.0.3",
|
||||
"sqlite3": "4.1.1",
|
||||
"string-similarity": "4.0.1",
|
||||
"tar-stream": "2.1.1",
|
||||
"turndown": "5.0.3",
|
||||
"tar-stream": "2.1.2",
|
||||
"turndown": "6.0.0",
|
||||
"turndown-plugin-gfm": "1.0.2",
|
||||
"unescape": "1.0.1",
|
||||
"ws": "7.2.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"electron": "9.0.0-beta.7",
|
||||
"electron-builder": "22.4.0",
|
||||
"electron-builder": "22.4.1",
|
||||
"electron-packager": "14.2.1",
|
||||
"electron-rebuild": "1.10.0",
|
||||
"electron-rebuild": "1.10.1",
|
||||
"jsdoc": "3.6.3",
|
||||
"lorem-ipsum": "2.0.3"
|
||||
},
|
||||
|
@ -13,6 +13,50 @@ export default class TabCachingWidget extends TabAwareWidget {
|
||||
return this.$widget = $(`<div class="marker" style="display: none;">`);
|
||||
}
|
||||
|
||||
async newTabOpenedEvent({tabContext}) {
|
||||
const {tabId} = tabContext;
|
||||
|
||||
if (this.widgets[tabId]) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.widgets[tabId] = this.widgetFactory();
|
||||
|
||||
const $renderedWidget = this.widgets[tabId].render();
|
||||
this.widgets[tabId].toggleExt(this.isTab(tabId));
|
||||
|
||||
this.$widget.after($renderedWidget);
|
||||
|
||||
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
|
||||
|
||||
await this.widgets[tabId].handleEvent('setTabContext', {tabContext});
|
||||
|
||||
this.child(this.widgets[tabId]); // add as child only once it is ready (rendered with tabContext)
|
||||
}
|
||||
|
||||
tabRemovedEvent({tabId}) {
|
||||
const widget = this.widgets[tabId];
|
||||
|
||||
if (widget) {
|
||||
widget.remove();
|
||||
delete this.widgets[tabId];
|
||||
|
||||
this.children = this.children.filter(ch => ch !== widget);
|
||||
}
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
this.toggleExt(true);
|
||||
}
|
||||
|
||||
toggleInt(show) {} // not needed
|
||||
|
||||
toggleExt(show) {
|
||||
for (const tabId in this.widgets) {
|
||||
this.widgets[tabId].toggleExt(show && this.isTab(tabId));
|
||||
}
|
||||
}
|
||||
|
||||
handleEventInChildren(name, data) {
|
||||
// stop propagation of the event to the children, individual tab widget should not know about tab switching
|
||||
// since they are per-tab
|
||||
@ -38,52 +82,4 @@ export default class TabCachingWidget extends TabAwareWidget {
|
||||
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
async newTabOpenedEvent({tabContext}) {
|
||||
const {tabId} = tabContext;
|
||||
|
||||
if (this.widgets[tabId]) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.widgets[tabId] = this.widgetFactory();
|
||||
|
||||
const $renderedWidget = this.widgets[tabId].render();
|
||||
this.widgets[tabId].toggleExt(this.widgets[tabId]);
|
||||
|
||||
this.$widget.after($renderedWidget);
|
||||
|
||||
keyboardActionsService.updateDisplayedShortcuts($renderedWidget);
|
||||
|
||||
await this.widgets[tabId].handleEvent('setTabContext', {tabContext});
|
||||
|
||||
this.child(this.widgets[tabId]); // add as child only once it is ready (rendered with tabContext)
|
||||
}
|
||||
|
||||
async refresh() {
|
||||
const activeTabId = this.tabContext && this.tabContext.tabId;
|
||||
|
||||
for (const tabId in this.widgets) {
|
||||
this.widgets[tabId].toggleExt(tabId === activeTabId);
|
||||
}
|
||||
}
|
||||
|
||||
tabRemovedEvent({tabId}) {
|
||||
const widget = this.widgets[tabId];
|
||||
|
||||
if (widget) {
|
||||
widget.remove();
|
||||
delete this.widgets[tabId];
|
||||
|
||||
this.children = this.children.filter(ch => ch !== widget);
|
||||
}
|
||||
}
|
||||
|
||||
toggleInt(show) {} // not needed
|
||||
|
||||
toggleByTab(show) {
|
||||
for (const tabId in this.widgets) {
|
||||
this.widgets[tabId].toggleExt(show && this.isTab(tabId));
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user