Prevent holding Control-Enter or Command-Enter from posting comment multiple times.

This commit is contained in:
Douwe Maan 2015-03-27 11:00:54 +01:00
parent 28592ae467
commit 7a70fb123c
2 changed files with 2 additions and 0 deletions

View File

@ -46,6 +46,7 @@ v 7.10.0 (unreleased)
- Refactor issue filtering
- AJAX selectbox for issue assignee and author filters
- Fix issue with missing options in issue filtering dropdown if selected one
- Prevent holding Control-Enter or Command-Enter from posting comment multiple times.
v 7.9.0
- Send EmailsOnPush email when branch or tag is created or deleted.

View File

@ -57,6 +57,7 @@ class @Notes
@notes_forms = '.js-main-target-form textarea, .js-discussion-note-form textarea'
# Chrome doesn't fire keypress or keyup for Command+Enter, so we need keydown.
$(document).on('keydown', @notes_forms, (e) ->
return if e.originalEvent.repeat
if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13)
$(@).parents('form').submit()
)