mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
refactoring, tab switching handling shouldn't be on the widget level
This commit is contained in:
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user