better filtering of empty HTML content (just tags and whitespace)

This commit is contained in:
azivner
2018-01-26 19:54:27 -05:00
parent 9f3d46ddb1
commit 0da13994a6
3 changed files with 6 additions and 6 deletions

View File

@@ -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 <p>&nbsp;</p>), 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();