diff options
author | ShaLi Shaltiel <shali3@gmail.com> | 2016-07-11 21:16:10 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-11 21:16:10 +0300 |
commit | 4ca88096bd2b745eeae050c44267673a5bfc6fce (patch) | |
tree | d8306168d1803c0dc6a10686a08e5ccb66d3662b | |
parent | 874b7bdc12803b24ec0c18e1de39dee316965ef6 (diff) |
Trying to use event.key if exist
-rwxr-xr-x | addons/webinterface.default/js/MediaLibrary.js | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/addons/webinterface.default/js/MediaLibrary.js b/addons/webinterface.default/js/MediaLibrary.js index a5bbe72b93..dd093347e7 100755 --- a/addons/webinterface.default/js/MediaLibrary.js +++ b/addons/webinterface.default/js/MediaLibrary.js @@ -149,15 +149,19 @@ MediaLibrary.prototype = { if (!key) { event.data.key = 'text'; - // Letters - if (which >= 65 && which <= 90) { - var offset = event.shiftKey ? 0 : 32; - event.data.text = String.fromCharCode(which + offset); - } - - // Digits - if (which >= 96 && which <= 105) { - event.data.text = (which-96)+""; + if (event.key && event.key.length === 1){ + event.data.text = event.key; + } else { + // Letters + if (which >= 65 && which <= 90) { + var offset = event.shiftKey ? 0 : 32; + event.data.text = String.fromCharCode(which + offset); + } + + // Digits + if (which >= 96 && which <= 105) { + event.data.text = (which-96)+""; + } } } |