This commit is contained in:
zadam 2020-02-28 00:31:12 +01:00
parent 2af37640d8
commit cb35284d37
4 changed files with 20 additions and 7 deletions

View file

@ -192,7 +192,10 @@ export default class TabManager extends Component {
if (activate) {
this.activateTab(tabContext.tabId, false);
this.triggerEvent('tabNoteSwitchedAndActivated');
this.triggerEvent('tabNoteSwitchedAndActivated', {
tabId: tabContext.tabId,
notePath
});
}
}

View file

@ -70,7 +70,7 @@ export default class SearchBoxWidget extends BasicWidget {
this.$saveSearchButton.on('click', () => this.saveSearch());
this.$closeSearchButton.on('click', () => this.triggerCommand('hideSearch'));
this.$closeSearchButton.on('click', () => this.hideSearch());
return this.$widget;
}
@ -142,7 +142,7 @@ export default class SearchBoxWidget extends BasicWidget {
this.$searchInput.trigger('focus');
}
hideSearchEvent() {
hideSearch() {
this.resetSearchEvent();
this.$searchBox.slideUp();
@ -155,7 +155,7 @@ export default class SearchBoxWidget extends BasicWidget {
this.showSearchEvent();
}
else {
this.hideSearchEvent();
this.hideSearch();
}
}

View file

@ -79,10 +79,12 @@ export default class TabAwareWidget extends BasicWidget {
}
// when note is both switched and activated, this should not produce double refresh
async tabNoteSwitchedAndActivatedEvent() {
this.tabContext = appContext.tabManager.getActiveTabContext();
async tabNoteSwitchedAndActivatedEvent({tabId, notePath}) {
if (this.isTab(tabId) && this.notePath === notePath) {
this.tabContext = appContext.tabManager.getActiveTabContext();
await this.refresh();
await this.refresh();
}
}
async treeCacheReloadedEvent() {

View file

@ -575,7 +575,15 @@ export default class TabRowWidget extends BasicWidget {
return closestIndex;
};
tabNoteSwitchedAndActivatedEvent({tabId}) {
this.updateTabById(tabId);
}
tabNoteSwitchedEvent({tabId}) {
this.updateTabById(tabId);
}
updateTabById(tabId) {
const $tab = this.getTabById(tabId);
const {note} = appContext.tabManager.getTabContextById(tabId);