mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 09:58:32 +02:00
removed last tab should activate second to last
This commit is contained in:
parent
8909d175d0
commit
aff02184f8
@ -239,13 +239,20 @@ export default class TabManager extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.triggerEvent('beforeTabRemove', {tabId}, true);
|
await this.triggerEvent('beforeTabRemove', {tabId});
|
||||||
|
|
||||||
if (this.tabContexts.length <= 1) {
|
if (this.tabContexts.length <= 1) {
|
||||||
this.openAndActivateEmptyTab();
|
this.openAndActivateEmptyTab();
|
||||||
}
|
}
|
||||||
else if (tabContextToRemove.isActive()) {
|
else {
|
||||||
this.activateNextTabCommand();
|
const idx = this.tabContexts.findIndex(tc => tc.tabId === tabId);
|
||||||
|
|
||||||
|
if (idx === this.tabContexts.length - 1) {
|
||||||
|
this.activatePreviousTabCommand();
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.activateNextTabCommand();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.children = this.children.filter(tc => tc.tabId !== tabId);
|
this.children = this.children.filter(tc => tc.tabId !== tabId);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user