diff options
author | Nicolas <nicolas@gitlab.com> | 2015-06-09 05:31:21 +0200 |
---|---|---|
committer | Nicolas <nicolas@gitlab.com> | 2015-06-09 05:31:21 +0200 |
commit | a68eabd212a0ca67b57435e049289f895dee8ac8 (patch) | |
tree | 38be5ca9c51f6688f867805de84a53e213800d00 /app | |
parent | b637f849503db06f38812184aec398f2e4e29d09 (diff) | |
download | gitlab-ce-a68eabd212a0ca67b57435e049289f895dee8ac8.tar.gz |
Make submit hotkey available to all notes forms.
Addresses #2221.
Diffstat (limited to 'app')
-rw-r--r-- | app/assets/javascripts/notes.js.coffee | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/app/assets/javascripts/notes.js.coffee b/app/assets/javascripts/notes.js.coffee index b9bd5c730bf..21656f59149 100644 --- a/app/assets/javascripts/notes.js.coffee +++ b/app/assets/javascripts/notes.js.coffee @@ -63,13 +63,11 @@ class @Notes # fetch notes when tab becomes visible $(document).on "visibilitychange", @visibilityChange - @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) -> + $(document).on 'keydown', '.js-note-text', (e) -> return if e.originalEvent.repeat if e.keyCode == 10 || ((e.metaKey || e.ctrlKey) && e.keyCode == 13) - $(@).parents('form').submit() - ) + $(@).closest('form').submit() cleanBinding: -> $(document).off "ajax:success", ".js-main-target-form" @@ -84,7 +82,7 @@ class @Notes $(document).off "click", ".js-discussion-reply-button" $(document).off "click", ".js-add-diff-note-button" $(document).off "visibilitychange" - $(document).off "keydown", @notes_forms + $(document).off "keydown", ".js-note-text" $(document).off "keyup", ".js-note-text" $(document).off "click", ".js-note-target-reopen" $(document).off "click", ".js-note-target-close" |