diff --git a/changelog.txt b/changelog.txt index 5e7072f..54517c9 100644 --- a/changelog.txt +++ b/changelog.txt @@ -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 diff --git a/configurator.py b/configurator.py index 30ea80e..e890b1d 100755 --- a/configurator.py +++ b/configurator.py @@ -2082,7 +2082,6 @@ INDEX = Template(r""" } window.onfocus = function() { - console.log("got focus"); got_focus_or_visibility(); } //window.onblur = function() { @@ -2104,7 +2103,7 @@ INDEX = Template(r""" hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; } - + function handleVisibilityChange() { if (document[hidden]) { // We're doing nothing when the tab gets out of vision @@ -2122,7 +2121,16 @@ INDEX = Template(r""" // Handle page visibility change 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(); diff --git a/dev.html b/dev.html index 05c7255..4fbb627 100644 --- a/dev.html +++ b/dev.html @@ -1998,7 +1998,6 @@ } window.onfocus = function() { - console.log("got focus"); got_focus_or_visibility(); } //window.onblur = function() { @@ -2020,7 +2019,7 @@ hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; } - + function handleVisibilityChange() { if (document[hidden]) { // We're doing nothing when the tab gets out of vision @@ -2038,7 +2037,16 @@ // Handle page visibility change 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();