Skip to content

Commit

Permalink
feat: ctrl-s now saves on settingsv1/v2 forms
Browse files Browse the repository at this point in the history
... because nobody ever uses ctrl-s on a browser window.
  • Loading branch information
julianlam committed Sep 18, 2020
1 parent dc0a4a4 commit 8093142
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 6 additions & 1 deletion public/src/admin/settings.js
@@ -1,7 +1,7 @@
'use strict';


define('admin/settings', ['uploader'], function (uploader) {
define('admin/settings', ['uploader', 'mousetrap'], function (uploader, mousetrap) {
var Settings = {};

Settings.init = function () {
Expand Down Expand Up @@ -90,6 +90,11 @@ define('admin/settings', ['uploader'], function (uploader) {
});
});

mousetrap.bind('ctrl+s', function (ev) {
saveBtn.click();
ev.preventDefault();
});

handleUploads();
setupTagsInput();

Expand Down
10 changes: 10 additions & 0 deletions public/src/modules/settings.js
Expand Up @@ -509,6 +509,16 @@ define('settings', function () {
app.flags._unsaved = true;
});

var saveEl = document.getElementById('save');
if (saveEl) {
require(['mousetrap'], function (mousetrap) {
mousetrap.bind('ctrl+s', function (ev) {
saveEl.click();
ev.preventDefault();
});
});
}

callback(null, values);
});
},
Expand Down

0 comments on commit 8093142

Please sign in to comment.