diff options
author | Jonas Franz <info@jonasfranz.software> | 2017-09-22 08:17:31 +0200 |
---|---|---|
committer | Lunny Xiao <xiaolunwen@gmail.com> | 2017-09-22 14:17:31 +0800 |
commit | b4b0280e339767ae13ea994cee877a666255e65d (patch) | |
tree | 19980862d39c2c7d338d5089be4bc65c99a8c9dd /public/js | |
parent | 1be2b4a262ebb4713111f496b9dd4c106089fafe (diff) | |
download | gitea-b4b0280e339767ae13ea994cee877a666255e65d.tar.gz gitea-b4b0280e339767ae13ea994cee877a666255e65d.zip |
Ctrl + Enter to submit forms (#2540)
* Hotfix for "Add time manually" (https://github.com/go-gitea/gitea/pull/2211#issuecomment-328780125)
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Submit forms if Ctrl+Enter is pressed inside a textarea
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Adding separate class for Ctrl+Enter-Submit
Checking if alt key is pressed too
Signed-off-by: Jonas Franz <info@jonasfranz.software>
* Changing .ctrlenter to .js-quick-submit
Signed-off-by: Jonas Franz <info@jonasfranz.software>
Diffstat (limited to 'public/js')
-rw-r--r-- | public/js/index.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/public/js/index.js b/public/js/index.js index cded5e2a1a..c456395770 100644 --- a/public/js/index.js +++ b/public/js/index.js @@ -1579,6 +1579,7 @@ $(document).ready(function () { initCodeView(); initVueApp(); initTeamSettings(); + initCtrlEnterSubmit(); // Repo clone url. if ($('#repo-clone-url').length > 0) { @@ -1786,6 +1787,14 @@ function initVueComponents(){ }) } +function initCtrlEnterSubmit() { + $(".js-quick-submit").keydown(function(e) { + if (((e.ctrlKey && !e.altKey) || e.metaKey) && (e.keyCode == 13 || e.keyCode == 10)) { + $(this).closest("form").submit(); + } + }); +} + function initVueApp() { var el = document.getElementById('app'); if (!el) { |