Merge pull request #4300 from nishimaki10/add-auto-focus

Add global keypress event handler to make the auto-focus to input message
pull/4755/head
Gabriel Engel 9 years ago committed by GitHub
commit 5fae183e9c
  1. 9
      packages/rocketchat-ui-master/master/main.coffee

@ -29,6 +29,15 @@ Template.body.onRendered ->
if subscription.alert or subscription.unread > 0
Meteor.call 'readMessages', subscription.rid
$(document.body).on 'keypress', (e) ->
target = e.target
if /input|textarea|select/i.test(target.tagName)
return
$inputMessage = $('textarea.input-message')
if 0 == $inputMessage.length
return
$inputMessage.focus()
$(document.body).on 'click', 'a', (e) ->
link = e.currentTarget
if link.origin is s.rtrim(Meteor.absoluteUrl(), '/') and /msg=([a-zA-Z0-9]+)/.test(link.search)

Loading…
Cancel
Save