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; ...@@ -2230,9 +2230,8 @@ var editor;
return imageUrl; return imageUrl;
}) })
.push(AscCommon.downloadUrlAsBlob) .push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL) .push(function (blob) {
.push(function (dataUrl) { return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
}) })
.push(callback) .push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);}) //.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
......
...@@ -1002,10 +1002,8 @@ function InitDragAndDrop (oHtmlElement, callback) { ...@@ -1002,10 +1002,8 @@ function InitDragAndDrop (oHtmlElement, callback) {
} }
function UploadImageFiles (files, documentId, documentUserId, jwt, callback) { function UploadImageFiles (files, documentId, documentUserId, jwt, callback) {
if (files.length > 0) { if (files.length > 0) {
var file = files[0], var file = files[0];
reader = new FileReader(); Common.Gateway.jio_putAttachment(documentId, undefined, file)
reader.addEventListener('load', function () {
Common.Gateway.jio_putAttachment(documentId, undefined, reader.result)
.push(function (image_url) { .push(function (image_url) {
callback(Asc.c_oAscError.ID.No, 'jio:' + image_url); callback(Asc.c_oAscError.ID.No, 'jio:' + image_url);
}) })
...@@ -1013,17 +1011,6 @@ function UploadImageFiles (files, documentId, documentUserId, jwt, callback) { ...@@ -1013,17 +1011,6 @@ function UploadImageFiles (files, documentId, documentUserId, jwt, callback) {
console.log(error); console.log(error);
callback(Asc.c_oAscError.ID.Unknown); 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;
// });
} else { } else {
callback(Asc.c_oAscError.ID.Unknown); callback(Asc.c_oAscError.ID.Unknown);
} }
......
...@@ -3674,12 +3674,10 @@ background-repeat: no-repeat;\ ...@@ -3674,12 +3674,10 @@ background-repeat: no-repeat;\
}); });
//this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage); //this.sync_StartAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);
if (0 !== start.indexOf('data:')) { if (0 !== start.indexOf('data:')) {
queue queue.push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL);
} }
return queue.push(function (dataUrl) { return queue.push(function (blob) {
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl); return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
}) })
.push(callback) .push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);}) //.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);})
......
...@@ -4074,9 +4074,8 @@ background-repeat: no-repeat;\ ...@@ -4074,9 +4074,8 @@ background-repeat: no-repeat;\
return url; return url;
}) })
.push(AscCommon.downloadUrlAsBlob) .push(AscCommon.downloadUrlAsBlob)
.push(AscCommon.readBlobAsDataURL) .push(function (blob) {
.push(function (dataUrl) { return Common.Gateway.jio_putAttachment(t.documentId, undefined, blob);
return Common.Gateway.jio_putAttachment(t.documentId, undefined, dataUrl);
}) })
.push(callback) .push(callback)
//.push(function () {t.sync_EndAction(c_oAscAsyncActionType.BlockInteraction, c_oAscAsyncAction.UploadImage);}) //.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