last note viewed is displayed after loading the app. Doesn't work well with cloned notes yet, also scrolling to the item in the tree doesn't work yet.

This commit is contained in:
azivner
2017-08-22 21:23:10 -04:00
parent f5c07f0e19
commit e58b8e6c40
3 changed files with 20 additions and 5 deletions

View File

@@ -1,5 +1,8 @@
$(function(){
$.get(baseUrl + 'tree').then(notes => {
$.get(baseUrl + 'tree').then(resp => {
const notes = resp.notes;
const startNoteId = resp.start_note_id;
function copyTitle(notes) {
for (let note of notes) {
note.title = note.note_title;
@@ -33,6 +36,7 @@ $(function(){
}
$("#tree").fancytree({
autoScroll: true,
extensions: ["hotkeys"],
source: notes,
activate: function(event, data){
@@ -47,6 +51,13 @@ $(function(){
collapse: function(event, data) {
setExpanded(data.node.key, false);
},
init: function(event, data) {
console.log("Activating...");
if (startNoteId) {
data.tree.activateKey(startNoteId);
}
},
hotkeys: {
keydown: {
"insert": function(node) {