[Libreoffice-commits] online.git: loleaflet/src

Jan Holesovsky kendy at collabora.com
Fri Jan 15 00:24:47 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 ce69617fb8cd763254c6179d2a68c4097ad4d3b0
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 029e6f4..c68287b 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -117,8 +117,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') {
@@ -931,6 +935,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