mirror of
https://github.com/zadam/trilium.git
synced 2025-12-21 23:59:59 +01:00
fix(left-pane): only focus the note when toggling left pane visibility if necessary
This commit is contained in:
@@ -29,7 +29,11 @@ export default class LeftPaneContainer extends FlexContainer<Component> {
|
|||||||
if (visible) {
|
if (visible) {
|
||||||
this.triggerEvent("focusTree", {});
|
this.triggerEvent("focusTree", {});
|
||||||
} else {
|
} else {
|
||||||
this.triggerEvent("focusOnDetail", { ntxId: appContext.tabManager.getActiveContext()?.ntxId });
|
const ntxId = appContext.tabManager.getActiveContext()?.ntxId;
|
||||||
|
const noteContainer = document.querySelector(`.note-split[data-ntx-id="${ntxId}"]`);
|
||||||
|
if (!noteContainer?.contains(document.activeElement)) {
|
||||||
|
this.triggerEvent("focusOnDetail", { ntxId });
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
options.save("leftPaneVisible", this.currentLeftPaneVisible.toString());
|
options.save("leftPaneVisible", this.currentLeftPaneVisible.toString());
|
||||||
|
|||||||
Reference in New Issue
Block a user