diff options
author | Henry Castro <hcastro@collabora.com> | 2019-04-11 14:12:32 -0400 |
---|---|---|
committer | Henry Castro <hcastro@collabora.com> | 2019-04-12 15:24:42 +0200 |
commit | 6987c3509c47a063a36311a5826fc4c4131846da (patch) | |
tree | 9c47f87c78ccfa184d187e6cf89dd3db2237b996 | |
parent | 54951870c3ed7c7f128d53449b4b0f77126117a8 (diff) |
loleaflet: fix the input method when receives 'compositionend' event
Change-Id: I296a714f41afb8a497e21661db0edf23d270b821
Reviewed-on: https://gerrit.libreoffice.org/70607
Reviewed-by: Henry Castro <hcastro@collabora.com>
Tested-by: Henry Castro <hcastro@collabora.com>
-rw-r--r-- | loleaflet/src/map/handler/Map.Keyboard.js | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js b/loleaflet/src/map/handler/Map.Keyboard.js index 28144cc53..7c3726099 100644 --- a/loleaflet/src/map/handler/Map.Keyboard.js +++ b/loleaflet/src/map/handler/Map.Keyboard.js @@ -394,12 +394,8 @@ L.Map.Keyboard = L.Handler.extend({ _onIME: function (e) { if (e.type === 'compositionstart' || e.type === 'compositionupdate') { this._isComposing = true; // we are starting composing with IME - var txt = ''; - for (var i = 0; i < e.originalEvent.data.length; i++) { - txt += e.originalEvent.data[i]; - } - if (txt) { - this._map._docLayer._postCompositionEvent(0, 'input', txt); + if (e.originalEvent.data.length > 0) { + this._map._docLayer._postCompositionEvent(0, 'input', e.originalEvent.data); } } @@ -410,10 +406,10 @@ L.Map.Keyboard = L.Handler.extend({ // is clear for the next word this._map._clipboardContainer.setValue(''); // Set all keycodes to zero - this._map._docLayer._postCompositionEvent(0, 'end', ''); + this._map._docLayer._postCompositionEvent(0, 'end', e.originalEvent.data); } - if (e.type === 'textInput' && !this._keyHandled) { + if (e.type === 'textInput' && !this._keyHandled && !this._isComposing) { // Hack for making space and spell-check text insert work // in Chrome (on Andorid) or Chrome with IME. // |