scroll to current note in the tree

This commit is contained in:
azivner 2017-09-16 11:37:50 -04:00
parent 4e298d9d85
commit fdc668e28b
4 changed files with 15 additions and 1 deletions

View File

@ -38,6 +38,10 @@
<img src="stat/icons/list.png" alt="Collapse tree"/>
</a>
<a onclick="scrollToCurrentNote()" title="Scroll to current note" class="icon-action">
<img src="stat/icons/crosshair.png" alt="Collapse tree"/>
</a>
<div id="tree">
</div>
</div>

BIN
static/icons/crosshair.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 463 B

View File

@ -213,7 +213,7 @@ function decryptNoteAndSendToServer() {
function decryptNoteIfNecessary(note) {
if (note.detail.encryption > 0) {
return decryptNote(note);
decryptNote(note);
}
}

View File

@ -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);