refactoring, tab switching handling shouldn't be on the widget level

This commit is contained in:
zadam
2023-09-13 09:01:55 +02:00
parent 7848c7e319
commit d46801ff1f
9 changed files with 553 additions and 52 deletions

View File

@@ -173,7 +173,10 @@ export default class TabManager extends Component {
return this.noteContexts;
}
/** @returns {NoteContext[]} */
/**
* Main context is essentially a tab (children are splits), so this returns tabs.
* @returns {NoteContext[]}
*/
getMainNoteContexts() {
return this.noteContexts.filter(nc => nc.isMainContext());
}
@@ -189,14 +192,22 @@ export default class TabManager extends Component {
return noteContext;
}
/** @returns {NoteContext} */
/**
* Get active context which represents the visible split with focus. Active context can, but doesn't have to be "main".
*
* @returns {NoteContext}
*/
getActiveContext() {
return this.activeNtxId
? this.getNoteContextById(this.activeNtxId)
: null;
}
/** @returns {NoteContext} */
/**
* Get active main context which corresponds to the active tab.
*
* @returns {NoteContext}
*/
getActiveMainContext() {
return this.activeNtxId
? this.getNoteContextById(this.activeNtxId).getMainContext()