mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	empty note with just included note should be saved, closes #807
This commit is contained in:
		@@ -116,15 +116,19 @@ class NoteDetailText {
 | 
				
			|||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    getContent() {
 | 
					    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
 | 
					        // if content is only tags/whitespace (typically <p> </p>), then just make it empty
 | 
				
			||||||
        // this is important when setting new note to code
 | 
					        // this is important when setting new note to code
 | 
				
			||||||
        if (jQuery(content).text().trim() === '' && !content.includes("<img")) {
 | 
					        return this.isContentEmpty(content) ? '' : content;
 | 
				
			||||||
            content = '';
 | 
					    }
 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return content;
 | 
					    isContentEmpty(content) {
 | 
				
			||||||
 | 
					        content = content.toLowerCase();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        return jQuery(content).text().trim() === ''
 | 
				
			||||||
 | 
					            && !content.includes("<img")
 | 
				
			||||||
 | 
					            && !content.includes("<section")
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    async isReadOnly() {
 | 
					    async isReadOnly() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -213,7 +213,11 @@ function closeActiveDialog() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function isHtmlEmpty(html) {
 | 
					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() {
 | 
					async function clearBrowserCache() {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -968,3 +968,7 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href
 | 
				
			|||||||
    border-radius: 10px;
 | 
					    border-radius: 10px;
 | 
				
			||||||
    background-color: var(--accented-background-color);
 | 
					    background-color: var(--accented-background-color);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					.include-note.ck-placeholder::before { /* remove placeholder in otherwise empty note */
 | 
				
			||||||
 | 
					    content: '' !important;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user