recent notes and insert link now include whole note path

This commit is contained in:
azivner
2017-09-03 15:08:17 -04:00
parent 8a388842aa
commit 81c534104f
4 changed files with 68 additions and 25 deletions

View File

@@ -104,6 +104,28 @@ const keybindings = {
const globalNoteNames = {};
let globalTree;
function getNodeByKey(noteId) {
return globalTree.fancytree('getNodeByKey', noteId);
}
function getFullName(noteId) {
let note = getNodeByKey(noteId);
const path = [];
while (note) {
path.push(note.title);
note = note.getParent();
}
// remove "root" element
path.pop();
return path.reverse().join(" > ");
}
$(function(){
$.get(baseUrl + 'tree').then(resp => {
const notes = resp.notes;
@@ -145,7 +167,8 @@ $(function(){
});
}
$("#tree").fancytree({
globalTree = $("#tree");
globalTree.fancytree({
autoScroll: true,
extensions: ["hotkeys", "filter"],
source: notes,