From 262b02c1b2e873ece98519e3644e5749566efb1f Mon Sep 17 00:00:00 2001 From: azivner Date: Thu, 21 Dec 2017 22:00:44 -0500 Subject: [PATCH] scroll to current page after loading app --- public/javascripts/note_tree.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 0fbcf15a7..b913ef4d5 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -422,6 +422,10 @@ const noteTree = (function() { if (startNotePath) { activateNode(startNotePath); + + // looks like this this doesn't work when triggered immediatelly after activating node + // so waiting a second helps + setTimeout(scrollToCurrentNote, 1000); } else { showAppIfHidden(); @@ -536,7 +540,7 @@ const noteTree = (function() { $(document).bind('keydown', 'alt+c', collapseTree); function scrollToCurrentNote() { - const node = noteTree.getCurrentNode(); + const node = getCurrentNode(); if (node) { node.makeVisible({scrollIntoView: true});