fix JSON saving bug

This commit is contained in:
azivner 2018-04-08 08:31:19 -04:00
parent d2e2caed62
commit 120888b53e
2 changed files with 9 additions and 1 deletions

View File

@ -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";
}

View File

@ -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();