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

Jan Holesovsky kendy at collabora.com
Fri Jan 15 00:21:59 PST 2016


 loleaflet/src/layer/tile/TileLayer.js |   15 +++++++++++++++
 loleaflet/src/map/Map.js              |    3 ++-
 2 files changed, 17 insertions(+), 1 deletion(-)

New commits:
commit 5bf5125904fd0c166622b764fd365b8151b06e25
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Fri Jan 15 09:20:20 2016 +0100

    loleaflet: Support for 'drop', 'text/plain' only for now.

diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index dd76167..0d5ccaf 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -118,8 +118,12 @@ L.TileLayer = L.GridLayer.extend({
 		map._fadeAnimated = false;
 		this._viewReset();
 		map.on('drag resize zoomend', this._updateScrollOffset, this);
+
 		map.on('copy', this._onCopy, this);
 		map.on('paste', this._onPaste, this);
+		map.on('dragover', this._onDragOver, this);
+		map.on('drop', this._onDrop, this);
+
 		map.on('zoomend', this._onUpdateCursor, this);
 		map.on('zoomend', this._onUpdatePartPageRectangles, this);
 		if (this._docType === 'spreadsheet') {
@@ -933,6 +937,17 @@ L.TileLayer = L.GridLayer.extend({
 		this._map._socket.sendMessage('paste mimetype=text/plain;charset=utf-8 data=' + e.clipboardData.getData('text/plain'));
 	},
 
+	_onDragOver: function (e) {
+		e = e.originalEvent;
+		e.preventDefault();
+	},
+
+	_onDrop: function (e) {
+		e = e.originalEvent;
+		e.preventDefault();
+		this._map._socket.sendMessage('paste mimetype=text/plain;charset=utf-8 data=' + e.dataTransfer.getData("text/plain"));
+	},
+
 	_onDragStart: function () {
 		this._map.on('moveend', this._updateScrollOffset, this);
 	},
diff --git a/loleaflet/src/map/Map.js b/loleaflet/src/map/Map.js
index a4c5aea..e5749f6 100644
--- a/loleaflet/src/map/Map.js
+++ b/loleaflet/src/map/Map.js
@@ -598,7 +598,8 @@ L.Map = L.Evented.extend({
 		var onOff = remove ? 'off' : 'on';
 
 		L.DomEvent[onOff](this._container, 'click dblclick mousedown mouseup ' +
-			'mouseover mouseout mousemove contextmenu keydown keypress keyup trplclick qdrplclick', this._handleDOMEvent, this);
+			'mouseover mouseout mousemove contextmenu dragover drop ' +
+			'keydown keypress keyup trplclick qdrplclick', this._handleDOMEvent, this);
 		L.DomEvent[onOff](this._textArea, 'copy paste keydown keypress keyup', this._handleDOMEvent, this);
 
 		if (this.options.trackResize && this._resizeDetector.contentWindow) {


More information about the Libreoffice-commits mailing list