From fdc668e28b052c4227f3b5ffd636dfc872b4ca65 Mon Sep 17 00:00:00 2001 From: azivner Date: Sat, 16 Sep 2017 11:37:50 -0400 Subject: [PATCH] scroll to current note in the tree --- src/templates/app.html | 4 ++++ static/icons/crosshair.png | Bin 0 -> 463 bytes static/js/encryption.js | 2 +- static/js/tree.js | 10 ++++++++++ 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 static/icons/crosshair.png diff --git a/src/templates/app.html b/src/templates/app.html index 4993e0e69..88ae850c5 100644 --- a/src/templates/app.html +++ b/src/templates/app.html @@ -38,6 +38,10 @@ Collapse tree + + Collapse tree + +
diff --git a/static/icons/crosshair.png b/static/icons/crosshair.png new file mode 100644 index 0000000000000000000000000000000000000000..bf1bce8588ba3939a12d66593d7bf604a0dec9bb GIT binary patch literal 463 zcmV;=0WkiFP)wBR$w(g3Z6l zcv;}i1D#}Z$v?CI%+1dJ3;%3opb6XpF_37*!kUW7Z2`~*zJSG=HCJqqm3$8v8G<|D z64*Cb6}SR=1{(pDEaX#dcmrxFzaz6&2PVR&tC9q!@_Qik#P|}R*r9w+K*^V&Z7L6! z6cK4H8;Eytw0ur?ptS;1cWe&+N0Ci)phc}Ot_Hx4z%zY28%WSeaf153&?pwQs<>hc zCY}ovr!3$;WZ6LuwT<7VFHkYGbfc#V(GoKnb zsrUeP3rfX}FQ5cGD`1#Y?8?ByI*RVOZCRJ##8m#7@f?uZCA@2{Hirm&r83VicqT91;*yl9}8=&csu^az5z~iioVOY?fU=#002ovPDHLk FV1m%X!88B> literal 0 HcmV?d00001 diff --git a/static/js/encryption.js b/static/js/encryption.js index cbbe1b46d..1c6856b76 100644 --- a/static/js/encryption.js +++ b/static/js/encryption.js @@ -213,7 +213,7 @@ function decryptNoteAndSendToServer() { function decryptNoteIfNecessary(note) { if (note.detail.encryption > 0) { - return decryptNote(note); + decryptNote(note); } } diff --git a/static/js/tree.js b/static/js/tree.js index ffc6d5746..121aa893d 100644 --- a/static/js/tree.js +++ b/static/js/tree.js @@ -179,4 +179,14 @@ function collapseTree() { }); } +function scrollToCurrentNote() { + const node = getNodeByKey(globalCurrentNote.detail.note_id); + + if (node) { + node.makeVisible({scrollIntoView: true}); + + node.setFocus(); + } +} + $(document).bind('keydown', 'alt+c', collapseTree); \ No newline at end of file