loleaflet/src/layer/marker/Cursor.js  |   31 ++++++++++++++++++-------------
 loleaflet/src/layer/tile/TileLayer.js |    2 +-
 2 files changed, 19 insertions(+), 14 deletions(-)

New commits:
commit 779909deccd745ca8c447478174f1e5f78393e0d
Author: Pranav Kant <pran...@collabora.co.uk>
Date:   Wed Mar 28 22:35:51 2018 +0530

    Only create clipboard for one cursor
    
    Change-Id: Ief33fd516d2e1aecc561f32098fdd07a8cd98a20
    Reviewed-on: https://gerrit.libreoffice.org/52026
    Reviewed-by: Jan Holesovsky <ke...@collabora.com>
    Tested-by: Jan Holesovsky <ke...@collabora.com>
    (cherry picked from commit 98b53ae956782ce7366a2d4b29e80ce31b748058)
    Reviewed-on: https://gerrit.libreoffice.org/52065

diff --git a/loleaflet/src/layer/marker/Cursor.js 
b/loleaflet/src/layer/marker/Cursor.js
index 1189d9f1a..c370aa13e 100644
--- a/loleaflet/src/layer/marker/Cursor.js
+++ b/loleaflet/src/layer/marker/Cursor.js
@@ -26,12 +26,14 @@ L.Cursor = L.Layer.extend({
                this.update();
                this.getPane().appendChild(this._container);
 
-               this._map._textArea = this._textArea;
+               if (this._textArea && !this._map._textArea) {
+                       this._map._textArea = this._textArea;
 
-               L.DomEvent['off'](this._textArea, 'copy cut paste keydown 
keypress keyup compositionstart compositionupdate compositionend textInput', 
this._map._handleDOMEvent, this._map);
-               L.DomEvent['on'](this._textArea, 'copy cut paste keydown 
keypress keyup compositionstart compositionupdate compositionend textInput', 
this._map._handleDOMEvent, this._map);
+                       L.DomEvent['off'](this._textArea, 'copy cut paste 
keydown keypress keyup compositionstart compositionupdate compositionend 
textInput', this._map._handleDOMEvent, this._map);
+                       L.DomEvent['on'](this._textArea, 'copy cut paste 
keydown keypress keyup compositionstart compositionupdate compositionend 
textInput', this._map._handleDOMEvent, this._map);
 
-               this._textArea.focus();
+                       this._textArea.focus();
+               }
        },
 
        onRemove: function () {
@@ -75,7 +77,8 @@ L.Cursor = L.Layer.extend({
 
        show: function() {
                L.DomUtil.setStyle(this._container, 'visibility', 'visible');
-               this._textArea.focus();
+               if (this._textArea)
+                       this._textArea.focus();
        },
 
        hide: function() {
@@ -119,14 +122,16 @@ L.Cursor = L.Layer.extend({
                        .disableClickPropagation(this._cursor)
                        .disableScrollPropagation(this._container);
 
-               var textAreaContainer = L.DomUtil.create('div', 
'clipboard-container', this._container);
-               textAreaContainer.id = 'doc-clipboard-container';
-               this._textArea = L.DomUtil.create('input', 'clipboard', 
textAreaContainer);
-               this._textArea.setAttribute('type', 'text');
-               this._textArea.setAttribute('autocorrect', 'off');
-               this._textArea.setAttribute('autocapitalize', 'off');
-               this._textArea.setAttribute('autocomplete', 'off');
-               this._textArea.setAttribute('spellcheck', 'false');
+               if (this.options.clipboard) {
+                       var textAreaContainer = L.DomUtil.create('div', 
'clipboard-container', this._container);
+                       textAreaContainer.id = 'doc-clipboard-container';
+                       this._textArea = L.DomUtil.create('input', 'clipboard', 
textAreaContainer);
+                       this._textArea.setAttribute('type', 'text');
+                       this._textArea.setAttribute('autocorrect', 'off');
+                       this._textArea.setAttribute('autocapitalize', 'off');
+                       this._textArea.setAttribute('autocomplete', 'off');
+                       this._textArea.setAttribute('spellcheck', 'false');
+               }
        },
 
        _setPos: function (pos) {
diff --git a/loleaflet/src/layer/tile/TileLayer.js 
b/loleaflet/src/layer/tile/TileLayer.js
index 53d0420ab..4706ff1df 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -1435,7 +1435,7 @@ L.TileLayer = L.GridLayer.extend({
                        var cursorPos = this._visibleCursor.getNorthWest();
 
                        if (!this._cursorMarker) {
-                               this._cursorMarker = L.cursor(cursorPos, 
pixBounds.getSize().multiplyBy(this._map.getZoomScale(this._map.getZoom())), 
{blink: true});
+                               this._cursorMarker = L.cursor(cursorPos, 
pixBounds.getSize().multiplyBy(this._map.getZoomScale(this._map.getZoom())), 
{blink: true, clipboard: true});
                                this._map.addLayer(this._cursorMarker);
 
                                this._textArea = this._cursorMarker._textArea;
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to