Commit 58eb5965 authored by Boris Kocherov's avatar Boris Kocherov Committed by Romain Courteaud

[erp5_only_office] allow use object as jio_putAttachment argument

parent 2bffb96b
...@@ -109,13 +109,20 @@ DocsAPI.DocEditor.version = function () { ...@@ -109,13 +109,20 @@ DocsAPI.DocEditor.version = function () {
zip = g.props.value_zip_storage, zip = g.props.value_zip_storage,
queue, queue,
content_type, content_type,
start = data.slice(0, 5); start;
if (!docId) { if (!docId) {
docId = '/media/'; docId = '/media/';
} }
if (typeof data === 'string' && start === "data:") { if (typeof data === 'string') {
start = data.slice(0, 5);
if (start === "data:") {
data = dataURLtoBlob(data); data = dataURLtoBlob(data);
} }
}
if (typeof data === 'object' &&
!(data instanceof Blob)) {
data = new Blob([JSON.stringify(data, undefined, 2)]);
}
if (atId) { if (atId) {
queue = zip.putAttachment(docId, atId, data) queue = zip.putAttachment(docId, atId, data)
.push(undefined, function (error) { .push(undefined, function (error) {
......
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