Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
web-apps
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
0
Merge Requests
0
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
Boris Kocherov
web-apps
Commits
18a7a768
Commit
18a7a768
authored
Sep 20, 2017
by
Boris Kocherov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
merge with Vincent Bechu
@vincentB
work
parent
4c97aacf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
29 deletions
+21
-29
apps/common/main/gadget_ooffice.js
apps/common/main/gadget_ooffice.js
+21
-29
No files found.
apps/common/main/gadget_ooffice.js
View file @
18a7a768
...
...
@@ -2,6 +2,7 @@
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha*/
/*jslint nomen: true, maxlen:80, indent:2*/
"
use strict
"
;
if
(
Common
===
undefined
)
{
var
Common
=
{};
}
...
...
@@ -11,7 +12,6 @@ DocsAPI.DocEditor.version = function() {
};
(
function
(
rJS
,
RSVP
,
require
,
jIO
)
{
"
use strict
"
;
var
rusha
=
new
Rusha
();
...
...
@@ -65,7 +65,6 @@ DocsAPI.DocEditor.version = function() {
})
.
declareAcquiredMethod
(
"
triggerSubmit
"
,
"
triggerSubmit
"
)
.
declareAcquiredMethod
(
"
triggerMaximize
"
,
"
triggerMaximize
"
)
.
declareAcquiredMethod
(
"
setFillStyle
"
,
"
setFillStyle
"
)
.
declareAcquiredMethod
(
'
getSetting
'
,
'
getSetting
'
)
.
declareMethod
(
"
jio_getAttachment
"
,
function
(
docId
,
attId
,
opt
)
{
var
g
=
this
,
...
...
@@ -138,8 +137,8 @@ DocsAPI.DocEditor.version = function() {
content_type
=
"
application/binary
"
;
}
content_type
=
content_type
.
split
(
'
/
'
);
atId
=
content_type
[
0
]
+
'
,
'
+
digest
+
'
.
'
+
content_type
[
1
];
atId
=
content_type
[
0
]
+
'
,
'
+
digest
+
'
.
'
+
content_type
[
1
];
return
zip
.
allAttachments
(
docId
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
...
...
@@ -199,13 +198,7 @@ DocsAPI.DocEditor.version = function() {
console
.
log
();
})
.
declareMethod
(
'
goBack
'
,
function
(
new_window
)
{
var
g
=
this
;
g
.
triggerMaximize
()
.
push
(
function
(
size
)
{
var
iframe
=
g
.
props
.
element
.
querySelector
(
'
iframe
'
);
iframe
.
style
.
height
=
size
.
height
;
iframe
.
style
.
width
=
size
.
width
;
});
return
;
})
.
declareMethod
(
'
requestEditRights
'
,
function
()
{
var
g
=
this
;
...
...
@@ -256,7 +249,9 @@ DocsAPI.DocEditor.version = function() {
g
.
props
.
key
=
options
.
key
||
"
text_content
"
;
g
.
props
.
documentType
=
portal_type
.
toLowerCase
();
value
=
options
.
value
;
if
(
value
===
"
data:
"
||
value
===
undefined
)
{
if
(
value
===
"
data:
"
||
g
.
props
.
value
===
"
data:application/octet-stream;base64,
"
||
value
===
undefined
)
{
// fix empty value
value
=
""
;
}
...
...
@@ -280,7 +275,8 @@ DocsAPI.DocEditor.version = function() {
return
g
.
props
.
value_zip_storage
.
getAttachment
(
'
/
'
,
'
body.txt
'
)
.
push
(
undefined
,
function
(
error
)
{
if
(
error
.
status_code
===
404
)
{
throw
'
not supported format of document: "
'
+
value
.
slice
(
0
,
100
)
+
'
"
'
;
throw
'
not supported format of document: "
'
+
value
.
slice
(
0
,
100
)
+
'
"
'
;
}
throw
error
;
})
...
...
@@ -293,10 +289,15 @@ DocsAPI.DocEditor.version = function() {
return
value
;
})
.
push
(
function
(
value
)
{
var
magic
,
documentType
;
var
magic
,
documentType
,
sdkPath
,
nameSpace
,
backboneControllers
,
styles
;
g
.
props
.
value
=
value
;
if
(
!
g
.
props
.
documentType
&&
value
===
""
)
{
throw
"
can not create empty document because portal_type is unknown
"
;
throw
"
can not create empty document
"
+
"
because portal_type is unknown
"
;
}
if
(
value
)
{
magic
=
g
.
props
.
value
.
slice
(
0
,
4
);
...
...
@@ -318,24 +319,13 @@ DocsAPI.DocEditor.version = function() {
throw
"
editor not fit the document type
"
;
}
}
else
{
//set editor type by docu
e
mentType
//set editor type by documentType
g
.
props
.
documentType
=
documentType
;
}
}
if
(
!
g
.
props
.
value_zip_storage
)
{
g
.
props
.
value_zip_storage
=
jIO
.
createJIO
({
type
:
"
zipfile
"
});
}
return
g
.
setFillStyle
();
})
.
push
(
function
(
size
)
{
var
element
=
g
.
props
.
element
,
sdkPath
,
nameSpace
,
backboneControllers
,
styles
;
element
.
style
.
height
=
size
.
height
;
element
.
style
.
width
=
size
.
width
;
// g.fullscreen();
switch
(
g
.
props
.
documentType
)
{
case
'
spreadsheet
'
:
sdkPath
=
'
cell
'
;
...
...
@@ -670,8 +660,10 @@ DocsAPI.DocEditor.version = function() {
return
save_defer
.
promise
;
})
.
push
(
function
(
data
)
{
var
body
=
data
[
g
.
props
.
key
];
return
zip
.
putAttachment
(
'
/
'
,
'
body.txt
'
,
body
);
if
(
data
)
{
var
body
=
data
[
g
.
props
.
key
];
return
zip
.
putAttachment
(
'
/
'
,
'
body.txt
'
,
body
);
}
})
.
push
(
function
()
{
return
zip
.
getAttachment
(
'
/
'
,
'
/
'
);
...
...
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