loleaflet: enable drop of images
This commit is contained in:
parent
bcf0e2d81f
commit
8845679d2f
1 changed files with 10 additions and 10 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue