Commit 171fd428 authored by Boris Kocherov's avatar Boris Kocherov

jio gadget use blobs in put/getAttachment

parent 0b15156f
......@@ -2230,9 +2230,8 @@ var editor;
return imageUrl;
})
.push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL)
.push(function (dataUrl) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
.push(function (blob) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
})
.push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
......
......@@ -1002,28 +1002,15 @@ function InitDragAndDrop (oHtmlElement, callback) {
}
function UploadImageFiles (files, documentId, documentUserId, jwt, callback) {
if (files.length > 0) {
var file = files[0],
reader = new FileReader();
reader.addEventListener('load', function () {
Common.Gateway.jio_putAttachment(documentId, undefined, reader.result)
.push(function (image_url) {
callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
})
.push(undefined, function (error) {
console.log(error);
callback(Asc.c_oAscError.ID.Unknown);
});
});
reader.readAsDataURL(file);
//// not worked. throw csp error
//Common.Gateway.jio_putAttachment(documentId, undefined, URL.createObjectURL(file))
// .push(function (image_url) {
// callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
// })
// .push(undefined, function (error) {
// callback(Asc.c_oAscError.ID.Unknown);
// throw error;
// });
var file = files[0];
Common.Gateway.jio_putAttachment(documentId, undefined, file)
.push(function (image_url) {
callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
})
.push(undefined, function (error) {
console.log(error);
callback(Asc.c_oAscError.ID.Unknown);
});
} else {
callback(Asc.c_oAscError.ID.Unknown);
}
......
......@@ -3674,12 +3674,10 @@ background-repeat: no-repeat;\
});
//this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
if (0 !== start.indexOf('data:')) {
queue
.push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL);
queue.push(AscCommon.downloadUrlAsBlob)
}
return queue.push(function (dataUrl) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
return queue.push(function (blob) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
})
.push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
......
......@@ -4074,9 +4074,8 @@ background-repeat: no-repeat;\
return url;
})
.push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL)
.push(function (dataUrl) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
.push(function (blob) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
})
.push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment