mirror of
https://github.com/zadam/trilium.git
synced 2025-03-11 14:33:29 +08:00
reduce unnecessary tab activation events
This commit is contained in:
parent
3254b551d8
commit
52a907651e
4 changed files with 10 additions and 10 deletions
|
@ -314,6 +314,10 @@ class AppContext {
|
|||
}
|
||||
|
||||
activateTab(tabId) {
|
||||
if (tabId === this.activeTabId) {
|
||||
return;
|
||||
}
|
||||
|
||||
const oldActiveTabId = this.activeTabId;
|
||||
|
||||
this.activeTabId = tabId;
|
||||
|
|
|
@ -44,7 +44,6 @@ class TabContext extends Component {
|
|||
}
|
||||
|
||||
if (notePath === this.notePath) {
|
||||
console.log(`Setting existing notePath ${notePath} so ignoring ...`);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default class Component {
|
|||
async eventReceived(name, data, sync = false) {
|
||||
await this.initialized;
|
||||
|
||||
console.log(`Received ${name} to ${this.componentId}`);
|
||||
// console.log(`Received ${name} to ${this.componentId}`);
|
||||
|
||||
const fun = this[name + 'Listener'];
|
||||
|
||||
|
|
|
@ -218,6 +218,10 @@ export default class BookTypeWidget extends TypeWidget {
|
|||
async renderIntoElement(note, $container) {
|
||||
const childNotes = await note.getChildNotes();
|
||||
|
||||
if (childNotes.length === 0) {
|
||||
this.$help.show();
|
||||
}
|
||||
|
||||
for (const childNote of childNotes) {
|
||||
const childNotePath = this.tabContext.notePath + '/' + childNote.noteId;
|
||||
|
||||
|
@ -246,10 +250,6 @@ export default class BookTypeWidget extends TypeWidget {
|
|||
|
||||
$container.append($card);
|
||||
}
|
||||
|
||||
if (childNotes.length === 0) {
|
||||
this.$help.show();
|
||||
}
|
||||
}
|
||||
|
||||
/** @return {boolean} true if this is "auto book" activated (empty text note) and not explicit book note */
|
||||
|
@ -276,10 +276,7 @@ export default class BookTypeWidget extends TypeWidget {
|
|||
}
|
||||
}
|
||||
|
||||
getContent() {
|
||||
// for auto-book cases when renaming title there should be content
|
||||
return "";
|
||||
}
|
||||
getContent() {}
|
||||
|
||||
focus() {}
|
||||
|
||||
|
|
Loading…
Reference in a new issue