mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
hook on hash change which allows us navigation with alt-left, alt-right
This commit is contained in:
@@ -505,12 +505,16 @@ const noteTree = (function() {
|
||||
await getTree().reload(notes);
|
||||
}
|
||||
|
||||
function getNotePathFromAddress() {
|
||||
return document.location.hash.substr(1); // strip initial #
|
||||
}
|
||||
|
||||
function loadTree() {
|
||||
return server.get('tree').then(resp => {
|
||||
startNotePath = resp.start_note_path;
|
||||
|
||||
if (document.location.hash) {
|
||||
startNotePath = document.location.hash.substr(1); // strip initial #
|
||||
startNotePath = getNotePathFromAddress();
|
||||
}
|
||||
|
||||
return prepareNoteTree(resp.notes);
|
||||
@@ -668,6 +672,12 @@ const noteTree = (function() {
|
||||
|
||||
$(document).bind('keydown', 'ctrl+.', scrollToCurrentNote);
|
||||
|
||||
$(window).bind('hashchange', function() {
|
||||
const notePath = getNotePathFromAddress();
|
||||
|
||||
activateNode(notePath);
|
||||
});
|
||||
|
||||
return {
|
||||
reload,
|
||||
collapseTree,
|
||||
|
||||
Reference in New Issue
Block a user