From 69f77ac43998a5b837158a86b187f85e3ad8320c Mon Sep 17 00:00:00 2001 From: azivner Date: Wed, 29 Nov 2017 21:13:12 -0500 Subject: [PATCH] update note title in tree real time instead of waiting for save event --- public/javascripts/note_editor.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js index 5bc286c02..8f90c2516 100644 --- a/public/javascripts/note_editor.js +++ b/public/javascripts/note_editor.js @@ -119,10 +119,10 @@ const noteEditor = (function() { noteDetailWrapperEl.show(); - noteTitleEl.val(currentNote.detail.note_title); - noteChangeDisabled = true; + noteTitleEl.val(currentNote.detail.note_title); + // Clear contents and remove all stored history. This is to prevent undo from going across notes noteDetailEl.summernote('reset'); @@ -140,7 +140,13 @@ const noteEditor = (function() { } $(document).ready(() => { - noteTitleEl.on('input', noteChanged); + noteTitleEl.on('input', () => { + noteChanged(); + + const title = noteTitleEl.val(); + + noteTree.setNoteTitle(getCurrentNoteId(), title); + }); noteDetailEl.summernote({ airMode: true,