non null note title and content in the DB schema, allow saving non-valid JSON notes, children overview style changes

This commit is contained in:
azivner
2018-04-11 00:10:11 -04:00
parent 7b59a665dd
commit a4eafb934f
8 changed files with 189 additions and 138 deletions

View File

@@ -17,17 +17,16 @@ class Note extends Entity {
protected_session.decryptNote(this);
}
if (this.isJson()) {
this.jsonContent = JSON.parse(this.content);
}
this.setContent(this.content);
}
setContent(content) {
this.content = content;
if (this.isJson()) {
try {
this.jsonContent = JSON.parse(this.content);
}
catch(e) {}
}
isJson() {
@@ -142,7 +141,7 @@ class Note extends Entity {
beforeSaving() {
super.beforeSaving();
if (this.isJson()) {
if (this.isJson() && this.jsonContent) {
this.content = JSON.stringify(this.jsonContent, null, '\t');
}