diff --git a/bower.json b/bower.json index 13bb431b..c12e07d7 100644 --- a/bower.json +++ b/bower.json @@ -32,7 +32,8 @@ "js-sequence-diagrams": "https://github.com/benweet/js-sequence-diagrams.git#d60c973aa0ff148dc588c7ceee0b41e59dff3f9f", "flowchart": "https://github.com/adrai/flowchart.js.git#~1.2.10", "monetizejs": "~0.2.0", - "MathJax": "~2.4.0" + "MathJax": "~2.4.0", + "alertify.js": "https://github.com/fabien-d/alertify.js.git#fc2e06fa39873363dda199204b8544119ab060bf" }, "main": [ "/public/res/main.js", diff --git a/couchdb/setup-db.js b/couchdb/setup-db.js index abb9d841..549dfd38 100644 --- a/couchdb/setup-db.js +++ b/couchdb/setup-db.js @@ -18,6 +18,15 @@ var validate = function(newDoc) { if(!newDoc._id.match(/[a-zA-Z0-9]{24}/)) { throw({forbidden: 'Invalid ID format.'}); } + if(newDoc._deleted) { + if(newDoc.updated !== undefined || + newDoc.tags !== undefined || + newDoc.title !== undefined || + newDoc._attachments !== undefined) { + throw({forbidden: 'Deleted document must be empty.'}); + } + return; + } if(toString.call(newDoc.updated) !== '[object Number]') { throw({forbidden: 'Update time must be an integer.'}); } @@ -65,7 +74,9 @@ var validate = function(newDoc) { }; var byUpdate = function(doc) { - emit(doc.updated, null); + if(!doc.tags || !doc.tags.length) { + emit(doc.updated, null); + } }; var byTagAndUpdate = function(doc) { diff --git a/public/res/core.js b/public/res/core.js index 09894979..2cf5e6a4 100644 --- a/public/res/core.js +++ b/public/res/core.js @@ -393,7 +393,7 @@ define([ editor.focus(); // Revert to current theme when settings modal is closed applyTheme(window.theme); - }).on('keyup', '.modal', function(e) { + }).on('keypress', '.modal', function(e) { // Handle enter key in modals if(e.which == 13 && !$(e.target).is("textarea")) { $(this).find(".modal-footer a:last").click(); diff --git a/public/res/html/bodyEditor.html b/public/res/html/bodyEditor.html index dd2be731..ec971711 100644 --- a/public/res/html/bodyEditor.html +++ b/public/res/html/bodyEditor.html @@ -89,7 +89,7 @@
Synchronize
- Open/save in the Cloud + Open/Save in the Cloud