mirror of
https://github.com/zadam/trilium.git
synced 2025-10-27 17:27:01 +08:00
realoding tree doesn't steal focus (important for promoted attribute changes with attached scripts)
This commit is contained in:
parent
36dc802d16
commit
7cca2d9247
1 changed files with 7 additions and 3 deletions
|
|
@ -105,9 +105,13 @@ async function activateNode(notePath) {
|
||||||
|
|
||||||
const node = await expandToNote(notePath);
|
const node = await expandToNote(notePath);
|
||||||
|
|
||||||
await node.setActive();
|
// we use noFocus because when we reload the tree because of background changes
|
||||||
|
// we don't want the reload event to steal focus from whatever was focused before
|
||||||
|
await node.setActive(true, { noFocus: true });
|
||||||
|
|
||||||
clearSelectedNodes();
|
clearSelectedNodes();
|
||||||
|
|
||||||
|
return node;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -283,11 +287,11 @@ async function treeInitialized() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (startNotePath) {
|
if (startNotePath) {
|
||||||
await activateNode(startNotePath);
|
const node = await activateNode(startNotePath);
|
||||||
|
|
||||||
// looks like this this doesn't work when triggered immediatelly after activating node
|
// looks like this this doesn't work when triggered immediatelly after activating node
|
||||||
// so waiting a second helps
|
// so waiting a second helps
|
||||||
setTimeout(scrollToCurrentNote, 1000);
|
setTimeout(() => node.makeVisible({scrollIntoView: true}), 1000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue