Skip to content

Commit

Permalink
Rework logic to remove confusion; add comment about why modifier keys…
Browse files Browse the repository at this point in the history
… are ignored.
  • Loading branch information
mjtko committed Mar 7, 2013
1 parent b47d9b4 commit 61f9614
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/assets/javascripts/backbone/views/chatbox.js.coffee
Expand Up @@ -11,7 +11,11 @@ class Kandan.Views.Chatbox extends Backbone.View


postMessageOnEnter: (event)->
if event.keyCode == 13 && !(event.metaKey || event.shiftKey || event.altKey || event.ctrlKey)
# If a modifier key is used with enter, messages are not posted.
# This allows the chatbox textarea to behave predictably, inline
# with usual form semantics (ie. ctrl+enter etc. generates a new
# line).
if event.keyCode == 13 && !event.metaKey && !event.shiftKey && !event.altKey && !event.ctrlKey
@postMessage(event)
event.preventDefault()

Expand Down

0 comments on commit 61f9614

Please sign in to comment.