[Libreoffice-commits] online.git: Branch 'distro/collabora/milestone-7' - loleaflet/src

Tomaž Vajngerl tomaz.vajngerl at collabora.com
Thu Jan 21 08:07:01 PST 2016


 loleaflet/src/layer/tile/TileLayer.js |   18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

New commits:
commit 26f061248ddd57cb9ab23307daa2a8f3cb6e3e8f
Author: Tomaž Vajngerl <tomaz.vajngerl at collabora.com>
Date:   Thu Jan 21 17:00:10 2016 +0100

    loleaflet: IE11 has his own way to access the clipboard

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 090d15a..605797a 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -988,7 +988,12 @@ L.TileLayer = L.GridLayer.extend({
 		e = e.originalEvent;
 		e.preventDefault();
 		if (this._selectionTextContent) {
-			e.clipboardData.setData('text/plain', this._selectionTextContent);
+			if (e.clipboardData) { // Standard
+				e.clipboardData.setData('text/plain', this._selectionTextContent);
+			}
+			else if (window.clipboardData) { // IE 11
+				window.clipboardData.setData('Text', this._selectionTextContent);
+			}
 		}
 	},
 
@@ -1004,7 +1009,16 @@ L.TileLayer = L.GridLayer.extend({
 	_onPaste: function (e) {
 		e = e.originalEvent;
 		e.preventDefault();
-		this._map._socket.sendMessage('paste mimetype=text/plain;charset=utf-8\n' + e.clipboardData.getData('text/plain'));
+		var pasteString = null;
+		if (e.clipboardData) { // Standard
+			pasteString = e.clipboardData.getData('text/plain');
+		}
+		else if (window.clipboardData) { // IE 11
+			pasteString = window.clipboardData.getData('Text');
+		}
+		if (pasteString) {
+			this._map._socket.sendMessage('paste mimetype=text/plain;charset=utf-8\n' + pasteString);
+		}
 	},
 
 	_onDragOver: function (e) {


More information about the Libreoffice-commits mailing list