mirror of
https://github.com/zadam/trilium.git
synced 2025-10-30 18:05:55 +01:00
avoid scrolling to active node without a reason, fixes #4031
This commit is contained in:
@@ -1002,6 +1002,13 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
this.activityDetected();
|
this.activityDetected();
|
||||||
|
|
||||||
const oldActiveNode = this.getActiveNode();
|
const oldActiveNode = this.getActiveNode();
|
||||||
|
|
||||||
|
const newActiveNode = this.noteContext?.notePath
|
||||||
|
&& !this.noteContext.note?.isDeleted
|
||||||
|
&& (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree())
|
||||||
|
&& await this.getNodeFromPath(this.noteContext.notePath);
|
||||||
|
|
||||||
|
if (newActiveNode !== oldActiveNode) {
|
||||||
let oldActiveNodeFocused = false;
|
let oldActiveNodeFocused = false;
|
||||||
|
|
||||||
if (oldActiveNode) {
|
if (oldActiveNode) {
|
||||||
@@ -1011,13 +1018,6 @@ export default class NoteTreeWidget extends NoteContextAwareWidget {
|
|||||||
oldActiveNode.setFocus(false);
|
oldActiveNode.setFocus(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.noteContext
|
|
||||||
&& this.noteContext.notePath
|
|
||||||
&& !this.noteContext.note?.isDeleted
|
|
||||||
&& (!treeService.isNotePathInHiddenSubtree(this.noteContext.notePath) || await hoistedNoteService.isHoistedInHiddenSubtree())
|
|
||||||
) {
|
|
||||||
const newActiveNode = await this.getNodeFromPath(this.noteContext.notePath);
|
|
||||||
|
|
||||||
if (newActiveNode) {
|
if (newActiveNode) {
|
||||||
if (!newActiveNode.isVisible()) {
|
if (!newActiveNode.isVisible()) {
|
||||||
await this.expandToNote(this.noteContext.notePath);
|
await this.expandToNote(this.noteContext.notePath);
|
||||||
|
|||||||
Reference in New Issue
Block a user