[Libreoffice-commits] online.git: 2 commits - loleaflet/src
Miklos Vajna
vmiklos at collabora.co.uk
Mon Jan 18 05:38:03 PST 2016
loleaflet/src/core/Socket.js | 4 +++-
loleaflet/src/layer/tile/TileLayer.js | 20 ++++++++++----------
2 files changed, 13 insertions(+), 11 deletions(-)
New commits:
commit 8845679d2f20cb85a41b28d2e0f93e50445a7434
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 14:37:37 2016 +0100
loleaflet: enable drop of images
diff --git a/loleaflet/src/layer/tile/TileLayer.js b/loleaflet/src/layer/tile/TileLayer.js
index 0f0d2eb..7d21699 100644
--- a/loleaflet/src/layer/tile/TileLayer.js
+++ b/loleaflet/src/layer/tile/TileLayer.js
@@ -972,16 +972,16 @@ L.TileLayer = L.GridLayer.extend({
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;
- handled = false;
+ var reader = new FileReader();
+ var socket = this._map._socket;
+ reader.onload = (function(aImg) {
+ return function(e) {
+ var blob = new Blob(['paste mimetype=' + file.type + '\n', e.target.result]);
+ socket.sendMessage(blob);
+ };
+ })(file);
+ reader.readAsArrayBuffer(file);
+ handled = true;
}
}
}
commit bcf0e2d81fd38820bb206311ed3bd280abb04412
Author: Miklos Vajna <vmiklos at collabora.co.uk>
Date: Mon Jan 18 14:36:46 2016 +0100
loleaflet: don't attempt to log binary ws frames
There is no correct encoding to create log strings for e.g. binary image
data.
diff --git a/loleaflet/src/core/Socket.js b/loleaflet/src/core/Socket.js
index beffb07..1358df9 100644
--- a/loleaflet/src/core/Socket.js
+++ b/loleaflet/src/core/Socket.js
@@ -41,7 +41,9 @@ L.Socket = L.Class.extend({
}
else if (socketState === 1) {
this.socket.send(msg);
- L.Log.log(msg, L.OUTGOING, coords);
+ // Only attempt to log text frames, not binary ones.
+ if (typeof msg === 'string')
+ L.Log.log(msg, L.OUTGOING, coords);
}
},
More information about the Libreoffice-commits
mailing list