fix import

This commit is contained in:
zadam
2021-07-20 13:29:11 +02:00
parent 98ee3b029a
commit c82308489b
6 changed files with 240 additions and 228 deletions

View File

@@ -304,9 +304,15 @@ export default class TabManager extends Component {
await this.triggerEvent('beforeTabRemove', { ntxIds: ntxIdsToRemove });
if (!noteContextToRemove.isMainContext()) {
await this.activateNoteContext(noteContextToRemove.getMainContext().ntxId);
const ntxId1 = noteContextToRemove.getMainContext().ntxId;
console.log(`Isn't main context, will try to activate ${ntxId1}`);
await this.activateNoteContext(ntxId1);
}
else if (this.mainNoteContexts.length <= 1) {
console.log("No main context remaining, opening new one");
await this.openAndActivateEmptyTab();
}
else if (ntxIdsToRemove.includes(this.activeNtxId)) {
@@ -358,16 +364,20 @@ export default class TabManager extends Component {
async activateNextTabCommand() {
const oldIdx = this.mainNoteContexts.findIndex(nc => nc.ntxId === this.activeNtxId);
const newActiveTabId = this.mainNoteContexts[oldIdx === this.noteContexts.length - 1 ? 0 : oldIdx + 1].ntxId;
const newActiveNtxId = this.mainNoteContexts[oldIdx === this.noteContexts.length - 1 ? 0 : oldIdx + 1].ntxId;
await this.activateNoteContext(newActiveTabId);
console.log(`Activating next one ${newActiveNtxId}`);
await this.activateNoteContext(newActiveNtxId);
}
async activatePreviousTabCommand() {
const oldIdx = this.mainNoteContexts.findIndex(nc => nc.ntxId === this.activeNtxId);
const newActiveTabId = this.mainNoteContexts[oldIdx === 0 ? this.noteContexts.length - 1 : oldIdx - 1].ntxId;
const newActiveNtxId = this.mainNoteContexts[oldIdx === 0 ? this.noteContexts.length - 1 : oldIdx - 1].ntxId;
await this.activateNoteContext(newActiveTabId);
console.log(`Activating previous one ${newActiveNtxId}`);
await this.activateNoteContext(newActiveNtxId);
}
async closeActiveTabCommand() {