Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Vincent Bechu
erp5
Commits
0e8af437
Commit
0e8af437
authored
Dec 07, 2018
by
Boris Kocherov
Committed by
Vincent Bechu
Jan 03, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[erp5_only_office] use jio.getAttachment optional parameter format
parent
90790a17
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
30 deletions
+20
-30
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
...tem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
+19
-29
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
...5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
+1
-1
No files found.
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice.gadget.js.js
View file @
0e8af437
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
Uint8ClampedArray,
TextDecoder, DesktopOfflineAppDocumentEndSave*/
/*jslint nomen: true, maxlen:80, indent:2*/
"
use strict
"
;
...
...
@@ -72,9 +73,10 @@ DocsAPI.DocEditor.version = function () {
.
declareAcquiredMethod
(
'
notifyChange
'
,
'
notifyChange
'
)
.
declareMethod
(
"
jio_getAttachment
"
,
function
(
docId
,
attId
,
opt
)
{
var
g
=
this
,
queue
;
convert
;
opt
=
opt
||
{};
if
(
attId
===
'
body.txt
'
||
attId
===
'
Editor.bin
'
)
{
opt
=
'
asBinArray
'
;
opt
=
{
'
format
'
:
'
bin_array
'
}
;
if
(
!
docId
)
{
docId
=
'
/
'
;
}
...
...
@@ -83,36 +85,24 @@ DocsAPI.DocEditor.version = function () {
docId
=
'
/media/
'
;
}
}
queue
=
g
.
props
.
value_zip_storage
.
getAttachment
(
docId
,
attId
)
if
(
opt
.
format
===
"
blob_url
"
)
{
convert
=
opt
.
format
;
delete
opt
.
format
;
}
if
(
opt
.
format
===
"
bin_array
"
)
{
convert
=
opt
.
format
;
opt
.
format
=
'
array_buffer
'
;
}
return
g
.
props
.
value_zip_storage
.
getAttachment
(
docId
,
attId
,
opt
)
.
push
(
function
(
blob
)
{
var
data
;
if
(
opt
===
"
asText
"
)
{
data
=
jIO
.
util
.
readBlobAsText
(
blob
)
.
then
(
function
(
evt
)
{
return
evt
.
target
.
result
;
});
}
else
if
(
opt
===
"
asBinArray
"
)
{
data
=
jIO
.
util
.
readBlobAsArrayBuffer
(
blob
)
.
then
(
function
(
evt
)
{
return
new
Uint8ClampedArray
(
evt
.
target
.
result
);
});
}
else
if
(
opt
===
"
asBlobURL
"
)
{
data
=
URL
.
createObjectURL
(
blob
);
}
else
if
(
opt
===
"
asDataURL
"
)
{
data
=
new
RSVP
.
Promise
(
function
(
resolve
,
reject
)
{
var
reader
=
new
FileReader
();
reader
.
addEventListener
(
'
load
'
,
function
()
{
resolve
(
reader
.
result
);
});
reader
.
addEventListener
(
'
error
'
,
reject
);
reader
.
readAsDataURL
(
blob
);
});
}
else
{
data
=
blob
;
if
(
convert
===
"
bin_array
"
)
{
return
new
Uint8ClampedArray
(
blob
);
}
return
data
;
if
(
convert
===
"
blob_url
"
)
{
return
URL
.
createObjectURL
(
blob
);
}
return
blob
;
});
return
queue
;
})
.
declareMethod
(
"
jio_putAttachment
"
,
function
(
docId
,
atId
,
data
)
{
var
g
=
this
,
...
...
bt5/erp5_only_office/SkinTemplateItem/portal_skins/erp5_only_office/onlyoffice/sdkjs/common/GlobalLoaders.js.js
View file @
0e8af437
...
...
@@ -509,7 +509,7 @@
queue
,
oThis
=
this
;
if
(
0
===
start
.
indexOf
(
'
jio:
'
))
{
queue
=
Common
.
Gateway
.
jio_getAttachment
(
this
.
Api
.
documentId
,
image_id
.
slice
(
4
),
'
asBlobURL
'
)
queue
=
Common
.
Gateway
.
jio_getAttachment
(
this
.
Api
.
documentId
,
image_id
.
slice
(
4
),
{
format
:
'
blob_url
'
}
)
.
push
(
undefined
,
function
(
error
)
{
console
.
error
(
error
);
return
""
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment