Browse Source

Submit a form with Ctrl+Enter / Command+Return (#29473).

Patch by Mizuki ISHIKAWA.


git-svn-id: http://svn.redmine.org/redmine/trunk@19986 e93f8b46-1217-0410-a6f0-8f06a7374b81
tags/4.2.0
Go MAEDA 3 years ago
parent
commit
f7dd231c58
1 changed files with 8 additions and 0 deletions
  1. 8
    0
      public/javascripts/application.js

+ 8
- 0
public/javascripts/application.js View File

@@ -851,6 +851,14 @@ function setupFilePreviewNavigation() {
}
}

$(document).on('keydown', 'form textarea', function(e) {
// Submit the form with Ctrl + Enter or Command + Return
var targetForm = $(e.target).closest('form');
if(e.keyCode == 13 && ((e.ctrlKey && !e.metaKey) || (!e.ctrlKey && e.metaKey) && targetForm.length)) {
$(e.target).closest('form').find('textarea').blur().removeData('changed');
targetForm.submit();
}
});


function hideOnLoad() {

Loading…
Cancel
Save