Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix JSON saving bug
azivner120888b53e39
diff --git a/src/entities/note.js b/src/entities/note.jsindex c118336670..2b5e9e7b7a 100644--- a/src/entities/note.js+++ b/src/entities/note.js@@ -21,6 +21,14 @@ class Note extends Entity {}}+ setContent(content) {+ this.content = content;++ if (this.isJson()) {+ this.jsonContent = JSON.parse(this.content);+ }+ }+isJson() {return this.mime === "application/json";}diff --git a/src/services/notes.js b/src/services/notes.jsindex eaa338df27..440a05bb0d 100644--- a/src/services/notes.js+++ b/src/services/notes.js@@ -198,7 +198,7 @@ async function updateNote(noteId, noteUpdates) {await saveNoteRevision(note);note.title = noteUpdates.title;- note.content = noteUpdates.content;+ note.setContent(noteUpdates.content);note.isProtected = noteUpdates.isProtected;await note.save();