mirror of
https://github.com/zadam/trilium.git
synced 2025-01-18 13:11:57 +08:00
fix saving only image in a note, fixes #77
This commit is contained in:
parent
8e95b080da
commit
90c5348ca7
1 changed files with 5 additions and 3 deletions
|
@ -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> </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();
|
||||
|
|
Loading…
Reference in a new issue