Skip to content

Build your personal knowledge base with Trilium Notes

fix saving only image in a note, fixes #77

azivner90c5348ca7a5
diff --git a/src/public/javascripts/note_editor.js b/src/public/javascripts/note_editor.js
index 84e3a1fa14..f55962f58f 100644
--- a/src/public/javascripts/note_editor.js
+++ b/src/public/javascripts/note_editor.js
@@ -77,13 +77,15 @@ const noteEditor = (function() {
function updateNoteFromInputs(note) {
if (note.detail.type === 'text') {
- note.detail.content = editor.getData();
+ let content = editor.getData();
// if content is only tags/whitespace (typically <p>&nbsp;</p>), then just make it empty
// this is important when setting new note to code
- if (jQuery(note.detail.content).text().trim() === '') {
- note.detail.content = ''
+ if (jQuery(content).text().trim() === '' && !content.includes("<img")) {
+ content = '';
}
+
+ note.detail.content = content;
}
else if (note.detail.type === 'code') {
note.detail.content = codeEditor.getValue();