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');
}

View File

@@ -6,8 +6,11 @@ class NoteFull extends NoteShort {
this.content = row.content;
if (this.isJson()) {
this.jsonContent = JSON.parse(this.content);
if (this.content !== "" && this.isJson()) {
try {
this.jsonContent = JSON.parse(this.content);
}
catch(e) {}
}
}
}

View File

@@ -249,7 +249,7 @@ div.ui-tooltip {
}
#note-detail-code {
height: 100%;
min-height: 200px;
}
.CodeMirror {
@@ -291,6 +291,14 @@ div.ui-tooltip {
}
#children-overview {
flex-grow: 1000;
flex-shrink: 1000;
flex-basis: 0px;
display: flex;
flex-wrap: wrap;
align-content: flex-start;
height: 100px;
overflow: auto;
}
.child-overview {
@@ -299,12 +307,15 @@ div.ui-tooltip {
padding: 10px;
background: #f4f4f4;
width: 150px;
height: 95px;
height: 90px;
line-height: 2em;
margin-right: 20px;
border-radius: 15px;
overflow: hidden;
text-align: center;
margin-top: 15px;
text-overflow: ellipsis;
word-wrap: break-word;
}
.child-overview a {

View File

@@ -3,7 +3,7 @@
const build = require('./build');
const packageJson = require('../../package');
const APP_DB_VERSION = 87;
const APP_DB_VERSION = 88;
module.exports = {
appVersion: packageJson.version,

View File

@@ -205,8 +205,7 @@
<input type="file" id="file-upload" style="display: none" />
</div>
<div id="children-overview" style="flex-grow: 1000; flex-shrink: 1000; flex-basis: 0px; height: 100px; overflow: auto; display: flex; flex-wrap: wrap">
</div>
<div id="children-overview"></div>
</div>
<div id="label-list">