mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
empty note with just included note should be saved, closes #807
This commit is contained in:
parent
7793552443
commit
d025cfee1b
@ -116,15 +116,19 @@ class NoteDetailText {
|
||||
}
|
||||
|
||||
getContent() {
|
||||
let content = this.textEditor.getData();
|
||||
const content = this.textEditor.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(content).text().trim() === '' && !content.includes("<img")) {
|
||||
content = '';
|
||||
}
|
||||
return this.isContentEmpty(content) ? '' : content;
|
||||
}
|
||||
|
||||
return content;
|
||||
isContentEmpty(content) {
|
||||
content = content.toLowerCase();
|
||||
|
||||
return jQuery(content).text().trim() === ''
|
||||
&& !content.includes("<img")
|
||||
&& !content.includes("<section")
|
||||
}
|
||||
|
||||
async isReadOnly() {
|
||||
|
@ -213,7 +213,11 @@ function closeActiveDialog() {
|
||||
}
|
||||
|
||||
function isHtmlEmpty(html) {
|
||||
return $("<div>").html(html).text().trim().length === 0 && !html.toLowerCase().includes('<img');
|
||||
html = html.toLowerCase();
|
||||
|
||||
return $("<div>").html(html).text().trim().length === 0
|
||||
&& !html.includes('<img')
|
||||
&& !html.includes('<section');
|
||||
}
|
||||
|
||||
async function clearBrowserCache() {
|
||||
|
@ -967,4 +967,8 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
background-color: var(--accented-background-color);
|
||||
}
|
||||
|
||||
.include-note.ck-placeholder::before { /* remove placeholder in otherwise empty note */
|
||||
content: '' !important;
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user