Merge branch 'master' into next60

This commit is contained in:
zadam
2023-04-17 22:27:21 +02:00
46 changed files with 629 additions and 345 deletions

View File

@@ -413,7 +413,12 @@ export default class TabManager extends Component {
await this.triggerEvent('beforeNoteContextRemove', { ntxIds: ntxIdsToRemove });
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) {
await this.openAndActivateEmptyTab();