Added ctrl+s keyboard shortcut

This commit is contained in:
Daniel Perna 2018-01-31 22:27:22 +01:00
parent 0eb2fd3ab0
commit a415d22589
3 changed files with 23 additions and 6 deletions

View file

@ -2,6 +2,7 @@ Version 0.2.6 (2018-)
- Displaying current filename in title (Issue #76) @danielperna84
- Added menu item to open configurator in new tab (Issue #76) @danielperna84
- Automatically load last viewed (and not closed) file via localStorage @danielperna84
- CTRL+s / CMD+s can now be used to save a file @danielperna84
Version 0.2.5 (2018-01-27)
- Added warning-logs for access failure @danielperna84

View file

@ -2082,7 +2082,6 @@ INDEX = Template(r"""<!DOCTYPE html>
}
window.onfocus = function() {
console.log("got focus");
got_focus_or_visibility();
}
//window.onblur = function() {
@ -2123,6 +2122,15 @@ INDEX = Template(r"""<!DOCTYPE html>
document.addEventListener(visibilityChange, handleVisibilityChange, false);
}
$(document).keydown(function(e) {
if ((e.key == 's' || e.key == 'S' ) && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
save();
return false;
}
return true;
});
$(document).ready(function () {
$('select').material_select();
$('.modal').modal();

View file

@ -1998,7 +1998,6 @@
}
window.onfocus = function() {
console.log("got focus");
got_focus_or_visibility();
}
//window.onblur = function() {
@ -2039,6 +2038,15 @@
document.addEventListener(visibilityChange, handleVisibilityChange, false);
}
$(document).keydown(function(e) {
if ((e.key == 's' || e.key == 'S' ) && (e.ctrlKey || e.metaKey)) {
e.preventDefault();
save();
return false;
}
return true;
});
$(document).ready(function () {
$('select').material_select();
$('.modal').modal();