loleaflet/src/map/Map.js                  |    6 ++++--
 loleaflet/src/map/handler/Map.Keyboard.js |    7 ++++++-
 2 files changed, 10 insertions(+), 3 deletions(-)

New commits:
commit ef2638298a3fe75ffd34fa82330a7e775090918b
Author: Pranav Kant <[email protected]>
Date:   Mon Apr 11 12:39:21 2016 +0530

    loleaflet: listen to composition events
    
    Treat 'compositionend' event as 'keypress' event with composited
    data.
    
    Change-Id: Ia1d35e3ce2c583259dc6b6179741050ed173fe64

diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index a1a768d..c01b430 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -671,7 +671,7 @@ L.Map = L.Evented.extend({
                L.DomEvent[onOff](this._container, 'click dblclick mousedown 
mouseup ' +
                        'mouseover mouseout mousemove contextmenu dragover drop 
' +
                        'keydown keypress keyup trplclick qdrplclick', 
this._handleDOMEvent, this);
-               L.DomEvent[onOff](this._textArea, 'copy cut paste keydown 
keypress keyup', this._handleDOMEvent, this);
+               L.DomEvent[onOff](this._textArea, 'copy cut paste keydown 
keypress keyup compositionend', this._handleDOMEvent, this);
 
                if (this.options.trackResize && 
this._resizeDetector.contentWindow) {
                        L.DomEvent[onOff](this._resizeDetector.contentWindow, 
'resize', this._onResize, this);
@@ -788,7 +788,9 @@ L.Map = L.Evented.extend({
                var data = {
                        originalEvent: e
                };
-               if (e.type !== 'keypress' && e.type !== 'keyup' && e.type !== 
'keydown' && e.type !== 'copy' && e.type !== 'cut' && e.type !== 'paste') {
+               if (e.type !== 'keypress' && e.type !== 'keyup' && e.type !== 
'keydown' &&
+                       e.type !== 'copy' && e.type !== 'cut' && e.type !== 
'paste' &&
+                       e.type !== 'compositionend') {
                        data.containerPoint = target instanceof L.Marker ?
                                        
this.latLngToContainerPoint(target.getLatLng()) : 
this.mouseEventToContainerPoint(e);
                        data.layerPoint = 
this.containerPointToLayerPoint(data.containerPoint);
diff --git a/loleaflet/src/map/handler/Map.Keyboard.js 
b/loleaflet/src/map/handler/Map.Keyboard.js
index b72c246..d6138b2 100644
--- a/loleaflet/src/map/handler/Map.Keyboard.js
+++ b/loleaflet/src/map/handler/Map.Keyboard.js
@@ -170,11 +170,13 @@ L.Map.Keyboard = L.Handler.extend({
 
                this._map.on('mousedown', this._onMouseDown, this);
                this._map.on('keydown keyup keypress', this._onKeyDown, this);
+               this._map.on('compositionend', this._onKeyDown, this);
        },
 
        removeHooks: function () {
                this._map.on('mousedown', this._onMouseDown, this);
                this._map.off('keydown keyup keypress', this._onKeyDown, this);
+               this._map.off('compositionend', this._onKeyDown, this);
        },
 
        _setPanOffset: function (pan) {
@@ -257,6 +259,9 @@ L.Map.Keyboard = L.Handler.extend({
 
                var charCode = e.originalEvent.charCode;
                var keyCode = e.originalEvent.keyCode;
+               if (e.type === 'compositionend') {
+                       charCode = keyCode = e.originalEvent.data.charCodeAt();
+               }
                var unoKeyCode = this._toUNOKeyCode(keyCode);
 
                if (this.modifier) {
@@ -273,7 +278,7 @@ L.Map.Keyboard = L.Handler.extend({
                        if (e.type === 'keydown' && 
this.handleOnKeyDown[keyCode] && charCode === 0) {
                                docLayer._postKeyboardEvent('input', charCode, 
unoKeyCode);
                        }
-                       else if (e.type === 'keypress' &&
+                       else if ((e.type === 'keypress' || e.type === 
'compositionend') &&
                                (!this.handleOnKeyDown[keyCode] || charCode !== 
0)) {
                                if (charCode === keyCode && charCode !== 13) {
                                        // Chrome sets keyCode = charCode for 
printable keys
_______________________________________________
Libreoffice-commits mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to