loleaflet/src/control/Control.MobileInput.js |   28 +++++++++++++++++++--------
 1 file changed, 20 insertions(+), 8 deletions(-)

New commits:
commit 5b33ec605f9a26d7f7070b2b030f8a7c953f96bd
Author:     Henry Castro <hcas...@collabora.com>
AuthorDate: Tue Sep 18 21:33:11 2018 -0400
Commit:     Andras Timar <andras.ti...@collabora.com>
CommitDate: Wed Sep 19 08:01:49 2018 +0200

    loleaflet: mobile: fix input text composition events
    
    Change-Id: I04446f8c29c4901ebe67e49ae8dffcfac286f300
    Reviewed-on: https://gerrit.libreoffice.org/60733
    Reviewed-by: Andras Timar <andras.ti...@collabora.com>
    Tested-by: Andras Timar <andras.ti...@collabora.com>

diff --git a/loleaflet/src/control/Control.MobileInput.js 
b/loleaflet/src/control/Control.MobileInput.js
index 156cb4294..312c99845 100644
--- a/loleaflet/src/control/Control.MobileInput.js
+++ b/loleaflet/src/control/Control.MobileInput.js
@@ -17,12 +17,16 @@ L.Control.MobileInput = L.Control.extend({
        },
 
        onGotFocus: function () {
-               this._map.addLayer(this._map._docLayer._cursorMarker);
+               if (this._map._docLayer._cursorMarker) {
+                       this._map.addLayer(this._map._docLayer._cursorMarker);
+               }
        },
 
        onLostFocus: function () {
-               this._textArea.value = '';
-               this._map.removeLayer(this._map._docLayer._cursorMarker);
+               if (this._map._docLayer._cursorMarker) {
+                       this._textArea.value = '';
+                       
this._map.removeLayer(this._map._docLayer._cursorMarker);
+               }
        },
 
        focus: function(focus) {
@@ -73,6 +77,7 @@ L.Control.MobileInput = L.Control.extend({
                L.DomEvent.on(this._textArea, stopEvents, 
L.DomEvent.stopPropagation)
                        .on(this._textArea, 'keydown keypress keyup', 
this.onKeyEvents, this)
                        .on(this._textArea, 'compositionstart compositionupdate 
compositionend textInput', this.onCompEvents, this)
+                       .on(this._textArea, 'input', this.onInput, this)
                        .on(this._textArea, 'focus', this.onGotFocus, this)
                        .on(this._textArea, 'blur', this.onLostFocus, this);
        },
@@ -85,6 +90,10 @@ L.Control.MobileInput = L.Control.extend({
                    unoKeyCode = handler._toUNOKeyCode(keyCode);
 
                this._keyHandled = this._keyHandled || false;
+               if (this._isComposing) {
+                       return;
+               }
+
                docLayer._resetPreFetching();
                if (handler._ignoreKeyEvent({originalEvent: e})) {
                        // key ignored
@@ -128,11 +137,6 @@ L.Control.MobileInput = L.Control.extend({
 
                if (e.type === 'compositionend') {
                        this._isComposing = false; // stop of composing with IME
-                       // get the composited char codes
-                       // clear the input now - best to do this ASAP so the 
input
-                       // is clear for the next word
-                       //map._clipboardContainer.setValue('');
-                       // Set all keycodes to zero
                        map._docLayer._postCompositionEvent(0, 'end', '');
                }
 
@@ -156,6 +160,14 @@ L.Control.MobileInput = L.Control.extend({
                        for (var idx = 0; idx < data.length; idx++) {
                                map._docLayer._postKeyboardEvent('input', 
data[idx].charCodeAt(), 0);
                        }
+                       this._textArea.value = '';
+               }
+               L.DomEvent.stopPropagation(e);
+       },
+
+       onInput: function (e) {
+               if (e.inputType && e.inputType === 'deleteContentBackward' && 
!this._keyHandled) {
+                       this._map._docLayer._postKeyboardEvent('input', 0, 
this._map.keyboard._toUNOKeyCode(8));
                }
                L.DomEvent.stopPropagation(e);
        }
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to