mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	better filtering of empty HTML content (just tags and whitespace)
This commit is contained in:
		| @@ -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> </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(); | ||||
|   | ||||
| @@ -800,8 +800,6 @@ const noteTree = (function() { | ||||
|     } | ||||
|  | ||||
|     $(document).bind('keydown', 'ctrl+o', e => { | ||||
|         console.log("pressed O"); | ||||
|  | ||||
|         const node = getCurrentNode(); | ||||
|         const parentNoteId = node.data.parent_note_id; | ||||
|         const isProtected = treeUtils.getParentProtectedStatus(node); | ||||
|   | ||||
| @@ -210,10 +210,6 @@ async function saveNoteImages(noteId, noteText, sourceId) { | ||||
| } | ||||
|  | ||||
| async function updateNote(noteId, newNote, dataKey, sourceId) { | ||||
|     if (newNote.detail.note_text === '<p> </p>') { | ||||
|         newNote.detail.note_text = '' | ||||
|     } | ||||
|  | ||||
|     if (newNote.detail.is_protected) { | ||||
|         await protected_session.encryptNote(dataKey, newNote.detail); | ||||
|     } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user