mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02:00
Merge pull request #3839 from soulsands/activate
Activating after removal of subContexts conforms to mainContexts
This commit is contained in:
commit
d3b17f586d
@ -388,7 +388,12 @@ export default class TabManager extends Component {
|
|||||||
await this.triggerEvent('beforeNoteContextRemove', { ntxIds: ntxIdsToRemove });
|
await this.triggerEvent('beforeNoteContextRemove', { ntxIds: ntxIdsToRemove });
|
||||||
|
|
||||||
if (!noteContextToRemove.isMainContext()) {
|
if (!noteContextToRemove.isMainContext()) {
|
||||||
await this.activateNoteContext(noteContextToRemove.getMainContext().ntxId);
|
const siblings = noteContextToRemove.getMainContext().getSubContexts();
|
||||||
|
const idx = siblings.findIndex(nc => nc.ntxId === noteContextToRemove.ntxId);
|
||||||
|
const contextToActivateIdx = idx === siblings.length - 1 ? idx - 1 : idx + 1;
|
||||||
|
const contextToActivate = siblings[contextToActivateIdx];
|
||||||
|
|
||||||
|
await this.activateNoteContext(contextToActivate.ntxId);
|
||||||
}
|
}
|
||||||
else if (this.mainNoteContexts.length <= 1) {
|
else if (this.mainNoteContexts.length <= 1) {
|
||||||
await this.openAndActivateEmptyTab();
|
await this.openAndActivateEmptyTab();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user