Feature #29473
closedSubmit a form with Ctrl+Enter / Command+Return
0%
Description
While editing issue, Ctrl+Enter should invoke "Submit"
While creating new issue Ctrl+Enter should invoke "Create"
Files
Related issues
Updated by Go MAEDA over 6 years ago
- Related to Feature #449: Keyboard shortcuts added
Updated by Davide Giacometti about 6 years ago
Updated by Kamil . about 6 years ago
Davide,
I've installed 0.2.0 version but it doesn't seem to work.
Both (while creating and editing) it displays browser popup "do you really want to leave this site"?
Updated by Go MAEDA over 4 years ago
+1
Many apps or services such as Gitlab, GitHub, Gmail, Outlook, Slack, Facebook, and Twitter support submitting a form by hitting Ctrl+Enter / ⌘+Return. I think that a lot of users are familiar with this shortcut key.
Redmine will be able to provide consistent UI with many other apps if the key combination is supported.
Updated by Mizuki ISHIKAWA over 4 years ago
- File feature-29473.patch feature-29473.patch added
I have attached a patch.
Add hisSubmitAction variable to not show "do you really want to leave this site?"
Not tested on Windows.
Updated by Go MAEDA over 4 years ago
- Target version set to Candidate for next major release
+1
Nice improvement.
Updated by Go MAEDA over 4 years ago
- Target version changed from Candidate for next major release to 4.2.0
Setting the target version to 4.2.0.
Updated by Mizuki ISHIKAWA over 4 years ago
- File feature-29473-v2.patch feature-29473-v2.patch added
I will attach the updated patch.
Updated by Go MAEDA over 4 years ago
The patch can be simplified as follows.
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index 7076aabcb..825d96c88 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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() {
- It is not necessary to process keydown events for
input[type="text"]
because it submits the form by pressing Enter/Return by default. The form is submitted also by Ctrl+Enter/Option+Return - If the keydown for
input
is removed,submit()
can always be used. we don't have to use bothclick()
andsubmit()
as attachment:feature-29473-v2.patch do. Modal dialogs to add a category or a target version also works as expected
Updated by Mizuki ISHIKAWA over 4 years ago
Go MAEDA wrote:
The patch can be simplified as follows.
[...]
- It is not necessary to process keydown events for
input[type="text"]
because it submits the form by pressing Enter/Return by default. The form is submitted also by Ctrl+Enter/Option+Return- If the keydown for
input
is removed,submit()
can always be used. we don't have to use bothclick()
andsubmit()
as attachment:feature-29473-v2.patch do. Modal dialogs to add a category or a target version also works as expected
That looks good.
Updated by Go MAEDA over 4 years ago
- Subject changed from Handle Ctrl+Enter while editing issue to Submit a form with Ctrl+Enter / Command+Return
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch. Thank you for improving Redmine.
Updated by Mischa The Evil over 4 years ago
- Precedes Feature #33918: Add documentation for #29473 added
Updated by Mizuki ISHIKAWA about 4 years ago
- File support-ajax-form.patch support-ajax-form.patch added
For Ajax form, using this shortcut key will result in an "Invalid form authenticity token" Error.
Example: When edit an existing journal note.
I wrote a patch to solve that problem.
Updated by Go MAEDA about 4 years ago
Mizuki ISHIKAWA wrote:
For Ajax form, using this shortcut key will result in an "Invalid form authenticity token" Error.
Example: When edit an existing journal note.I wrote a patch to solve that problem.
Committed the fix. Thank you.
Updated by Go MAEDA almost 4 years ago
- Has duplicate Feature #34912: Save ticket by pressing keyboard key added