diff --git a/www/js/editnote.js b/www/js/editnote.js
index 2364912..1a7712f 100644
--- a/www/js/editnote.js
+++ b/www/js/editnote.js
@@ -12,9 +12,9 @@ function saveme(callback) {
return;
}
app.toast.create({
- text: ' Saving...',
- closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
- }).open();
+ text: ' Saving...',
+ closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
+ }).open();
save_in_progress = true;
sync(); // update textareas with correct content
@@ -75,6 +75,18 @@ function exiteditor() {
}
}
+$(window).bind('keydown', function (event) {
+ if (event.ctrlKey || event.metaKey) {
+ switch (String.fromCharCode(event.which).toLowerCase()) {
+ case 's':
+ event.preventDefault();
+ sync();
+ saveme();
+ break;
+ }
+ }
+});
+
$("#noteframe").on("load", function () {
init();
});
\ No newline at end of file
diff --git a/www/pages/editor.html b/www/pages/editor.html
index 3e61a3e..469e27c 100644
--- a/www/pages/editor.html
+++ b/www/pages/editor.html
@@ -63,6 +63,18 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
"horizontal-rule"
]
});
+
+ window.addEventListener('keydown', function (event) {
+ if (event.ctrlKey || event.metaKey) {
+ switch (String.fromCharCode(event.which).toLowerCase()) {
+ case 's':
+ event.preventDefault();
+ window.parent.sync();
+ window.parent.saveme();
+ break;
+ }
+ }
+ });
}
function getMarkdown() {