Browse Source

Make Ctrl-S save note in editor

tags/v1.2.0
Skylar Ittner 8 months ago
parent
commit
26232618d4
2 changed files with 27 additions and 3 deletions
  1. 15
    3
      www/js/editnote.js
  2. 12
    0
      www/pages/editor.html

+ 15
- 3
www/js/editnote.js View File

@@ -12,9 +12,9 @@ function saveme(callback) {
return;
}
app.toast.create({
text: '<i class="fas fa-sync fa-spin"></i> &nbsp; Saving...',
closeTimeout: 2 * 60 * 1000 // two whole minutes should be enough for *any* connection.
}).open();
text: '<i class="fas fa-sync fa-spin"></i> &nbsp; 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();
});

+ 12
- 0
www/pages/editor.html View File

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

Loading…
Cancel
Save