key, keyCode

This commit is contained in:
Kevin Jahns
2014-08-16 17:41:47 +02:00
parent 339908d1de
commit 4ebd362a2b
14 changed files with 54 additions and 20 deletions

View File

@@ -180,7 +180,11 @@ module.exports = (HB)->
# consume all text-insert changes.
textfield.onkeypress = (event)->
char = String.fromCharCode event.keyCode
char = null
if event.key?
char = event.key
else
char = String.fromCharCode event.keyCode
if char.length > 0
pos = Math.min textfield.selectionStart, textfield.selectionEnd
diff = Math.abs(textfield.selectionEnd - textfield.selectionStart)