diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js index f8baf6efb..bd0d55ffa 100644 --- a/public/javascripts/note_editor.js +++ b/public/javascripts/note_editor.js @@ -68,6 +68,12 @@ const noteEditor = (function() { function updateNoteFromInputs(note) { if (note.detail.type === 'text') { note.detail.note_text = editor.getData(); + + // if content is only tags/whitespace (typically

 

), then just make it empty + // this is important when setting new note to code + if ($(note.detail.note_text).text().trim() === '') { + note.detail.note_text = '' + } } else if (note.detail.type === 'code') { note.detail.note_text = codeEditor.getValue(); diff --git a/public/javascripts/note_tree.js b/public/javascripts/note_tree.js index 736ca0597..52dbe1eca 100644 --- a/public/javascripts/note_tree.js +++ b/public/javascripts/note_tree.js @@ -800,8 +800,6 @@ const noteTree = (function() { } $(document).bind('keydown', 'ctrl+o', e => { - console.log("pressed O"); - const node = getCurrentNode(); const parentNoteId = node.data.parent_note_id; const isProtected = treeUtils.getParentProtectedStatus(node); diff --git a/services/notes.js b/services/notes.js index 741af8e55..f36bb0632 100644 --- a/services/notes.js +++ b/services/notes.js @@ -210,10 +210,6 @@ async function saveNoteImages(noteId, noteText, sourceId) { } async function updateNote(noteId, newNote, dataKey, sourceId) { - if (newNote.detail.note_text === '

 

') { - newNote.detail.note_text = '' - } - if (newNote.detail.is_protected) { await protected_session.encryptNote(dataKey, newNote.detail); }