loleaflet/src/layer/tile/TileLayer.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-)
New commits: commit fb229b4c689a627dca8d1f59d1bba5d729ac22a5 Author: Jan Holesovsky <ke...@collabora.com> Date: Fri Jan 15 11:08:57 2016 +0100 loleaflet: JS part of the HTML and images pasting. So far it is commented out, as it needs improvements on the loolwsd side too. diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js index 0d5ccaf..c868b8e 100644 --- a/loleaflet/src/layer/tile/TileLayer.js +++ b/loleaflet/src/layer/tile/TileLayer.js @@ -945,7 +945,39 @@ L.TileLayer = L.GridLayer.extend({ _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")); + + // handle content + var types = e.dataTransfer.types; + var handled = false; + for (var t = 0; !handled && t < types.length; t++) { + var type = types[t]; + if (type === 'text/html') { + // TODO this needs loolwsd fixing, to support multiline data (blob) + // this._map._socket.sendMessage('paste mimetype=text/html data=' + e.dataTransfer.getData(type)); + // handled = true; + } + else if (type === 'text/plain') { + this._map._socket.sendMessage('paste mimetype=text/plain;charset=utf-8 data=' + e.dataTransfer.getData(type)); + handled = true; + } + else if (type === 'Files') { + var files = e.dataTransfer.files; + for (var i = 0; i < files.length; ++i) { + var file = files[i]; + if (file.type.match(/image.*/)) { + // TODO this needs loolwsd fixing, to support multiline data (blob) + // var reader = new FileReader(); + // reader.onload = (function(aImg) { return function(e) { + // this._map._socket.sendMessageWithData('paste mimetype=' + file.type + 'length=' + ..., e.target.result); + // }; })(img); + // + // reader.readAsArrayBuffer(); + // + // handled = true; + } + } + } + } }, _onDragStart: function () { _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits