Make Ctrl-S save note in editor

master
Skylar Ittner 5 years ago
parent cd476b3f6d
commit 26232618d4

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

@ -63,6 +63,18 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
"horizontal-rule" "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() { function getMarkdown() {

Loading…
Cancel
Save