Skip to content

Commit

Permalink
fixed editing multiline text bug
Browse files Browse the repository at this point in the history
  • Loading branch information
rcaferati committed Jun 22, 2015
1 parent 37d7535 commit 6d08687
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions client/lib/chatMessages.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@
editing.id = id
element.classList.add("editing")
setTimeout ->
input.select()
, 10
input.focus()
, 5

clearEditing = ->
if editing.element
Expand Down Expand Up @@ -156,13 +156,16 @@
unless k in keyCodes
startTyping(rid, input)
else if k is 38 or k is 40 # Arrow Up or down
event.preventDefault()
event.stopPropagation()
if k is 38
return if input.value.slice(0, input.selectionStart).match(/[\n]/) isnt null
toPrevMessage()
else
return if input.value.slice(input.selectionEnd, input.value.length).match(/[\n]/) isnt null
toNextMessage()

event.preventDefault()
event.stopPropagation()

isScrollable: isScrollable
toBottom: toBottom
keydown: keydown
Expand Down

0 comments on commit 6d08687

Please sign in to comment.