diff --git a/static/js/init.js b/static/js/init.js index 75348797e..51d93842a 100644 --- a/static/js/init.js +++ b/static/js/init.js @@ -108,9 +108,6 @@ function getNodeIdFromLabel(label) { } $(document).bind('keydown', 'alt+l', function() { - var range = $('#noteDetail').summernote('createRange'); - console.log("range:", range); - $("#noteAutocomplete").val(''); $("#linkTitle").val(''); @@ -124,7 +121,7 @@ $(document).bind('keydown', 'alt+l', function() { let autocompleteItems = []; - for (let noteId in globalNoteNames) { + for (const noteId of globalAllNoteIds) { let fullName = getFullName(noteId); autocompleteItems.push({ diff --git a/static/js/note.js b/static/js/note.js index c9b2d3551..19052f2c5 100644 --- a/static/js/note.js +++ b/static/js/note.js @@ -42,8 +42,6 @@ function saveNoteIfChanged(callback) { note.detail.note_title = title; - globalNoteNames[note.detail.note_id] = title; - $.ajax({ url: baseUrl + 'notes/' + note.detail.note_id, type: 'PUT', @@ -112,7 +110,7 @@ function createNote(node, parentKey, target) { "note_id": result.note_id }; - globalNoteNames[result.note_id] = newNoteName; + globalAllNoteIds.push(result.note_id); newNoteCreated = true; diff --git a/static/js/tree.js b/static/js/tree.js index 98dac160f..dad3e2525 100644 --- a/static/js/tree.js +++ b/static/js/tree.js @@ -18,7 +18,7 @@ const keybindings = { node.getParent().renderTitle(); } - delete globalNoteNames[node.key]; + globalAllNoteIds = globalAllNoteIds.filter(e => e !== node.key); // remove from recent notes recentNotes = recentNotes.filter(note => note !== node.key); @@ -102,7 +102,7 @@ const keybindings = { } }; -const globalNoteNames = {}; +let globalAllNoteIds = []; let globalTree; @@ -137,7 +137,7 @@ $(function(){ function copyTitle(notes) { for (const note of notes) { - globalNoteNames[note.note_id] = note.note_title; + globalAllNoteIds.push(note.note_id); note.title = note.note_title;