fix saving only image in a note, fixes #77

This commit is contained in:
azivner 2018-03-07 20:19:53 -05:00
parent 8e95b080da
commit 90c5348ca7

View file

@ -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();