Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
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
sdkjs
Commits
61a298f6
Commit
61a298f6
authored
Apr 13, 2017
by
Alexander.Trofimov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix jszip get images from changes
parent
a1397636
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
14 deletions
+22
-14
common/editorscommon.js
common/editorscommon.js
+22
-14
No files found.
common/editorscommon.js
View file @
61a298f6
...
@@ -115,13 +115,15 @@ String.prototype.strongMatch = function(regExp){
...
@@ -115,13 +115,15 @@ String.prototype.strongMatch = function(regExp){
return
false
;
return
false
;
};
};
if
(
typeof
require
==
"
function
"
&&
!
window
[
"
XRegExp
"
]){
window
[
"
XRegExp
"
]
=
require
(
"
xregexp
"
);}
if
(
typeof
require
===
"
function
"
&&
!
window
[
"
XRegExp
"
])
{
window
[
"
XRegExp
"
]
=
require
(
"
xregexp
"
);
}
var
oZipChan
ges
=
null
;
var
oZipIma
ges
=
null
;
var
sDownloadServiceLocalUrl
=
"
../../../../downloadas
"
;
var
sDownloadServiceLocalUrl
=
"
../../../../downloadas
"
;
var
sUploadServiceLocalUrl
=
"
../../../../upload
"
;
var
sUploadServiceLocalUrl
=
"
../../../../upload
"
;
var
sUploadServiceLocalUrlOld
=
"
../../../../uploadold
"
;
var
sUploadServiceLocalUrlOld
=
"
../../../../uploadold
"
;
var
nMaxRequestLength
=
5242880
;
//5mb <requestLimits maxAllowedContentLength="30000000" /> default 30mb
var
nMaxRequestLength
=
5242880
;
//5mb <requestLimits maxAllowedContentLength="30000000" /> default 30mb
function
getBaseUrl
()
{
function
getBaseUrl
()
{
var
index_html
=
window
[
"
location
"
][
"
href
"
];
var
index_html
=
window
[
"
location
"
][
"
href
"
];
...
@@ -259,11 +261,10 @@ function loadFileContent(url, callback) {
...
@@ -259,11 +261,10 @@ function loadFileContent(url, callback) {
}
}
function
getImageFromChanges
(
name
)
{
function
getImageFromChanges
(
name
)
{
var
file
;
var
content
;
var
ext
=
GetFileExtension
(
name
);
var
ext
=
GetFileExtension
(
name
);
if
(
null
!==
ext
&&
oZipChanges
&&
(
file
=
oZipChanges
.
files
[
name
]))
{
if
(
null
!==
ext
&&
oZipImages
&&
(
content
=
oZipImages
[
name
]))
{
var
oFileArray
=
file
.
asUint8Array
();
return
'
data:image/
'
+
ext
+
'
;base64,
'
+
AscCommon
.
Base64Encode
(
content
,
content
.
length
,
0
);
return
'
data:image/
'
+
ext
+
'
;base64,
'
+
AscCommon
.
Base64Encode
(
oFileArray
,
oFileArray
.
length
,
0
);
}
}
return
null
;
return
null
;
}
}
...
@@ -305,6 +306,7 @@ function loadFileContent(url, callback) {
...
@@ -305,6 +306,7 @@ function loadFileContent(url, callback) {
}
}
if
(
changesUrl
)
{
if
(
changesUrl
)
{
oZipImages
=
{};
getJSZipUtils
().
getBinaryContent
(
changesUrl
,
function
(
err
,
data
)
{
getJSZipUtils
().
getBinaryContent
(
changesUrl
,
function
(
err
,
data
)
{
if
(
err
)
{
if
(
err
)
{
bEndLoadChanges
=
true
;
bEndLoadChanges
=
true
;
...
@@ -315,15 +317,20 @@ function loadFileContent(url, callback) {
...
@@ -315,15 +317,20 @@ function loadFileContent(url, callback) {
oResult
.
changes
=
[];
oResult
.
changes
=
[];
require
(
'
jszip
'
).
loadAsync
(
data
).
then
(
function
(
zipChanges
)
{
require
(
'
jszip
'
).
loadAsync
(
data
).
then
(
function
(
zipChanges
)
{
var
relativePaths
=
[];
var
promises
=
[];
var
promises
=
[];
zipChanges
.
forEach
(
function
(
relativePath
,
file
)
{
zipChanges
.
forEach
(
function
(
relativePath
,
file
)
{
if
(
relativePath
.
endsWith
(
'
.json
'
))
{
relativePaths
.
push
(
relativePath
);
promises
[
parseInt
(
relativePath
.
slice
(
'
changes
'
.
length
))]
=
file
.
async
(
'
string
'
);
promises
.
push
(
file
.
async
(
relativePath
.
endsWith
(
'
.json
'
)
?
'
string
'
:
'
uint8array
'
));
}
});
});
Promise
.
all
(
promises
).
then
(
function
(
values
)
{
Promise
.
all
(
promises
).
then
(
function
(
values
)
{
var
relativePath
;
for
(
var
i
=
0
;
i
<
values
.
length
;
++
i
)
{
for
(
var
i
=
0
;
i
<
values
.
length
;
++
i
)
{
oResult
.
changes
[
i
]
=
JSON
.
parse
(
values
[
i
]);
if
((
relativePath
=
relativePaths
[
i
]).
endsWith
(
'
.json
'
))
{
oResult
.
changes
[
parseInt
(
relativePath
.
slice
(
'
changes
'
.
length
))]
=
JSON
.
parse
(
values
[
i
]);
}
else
{
oZipImages
[
relativePath
]
=
values
[
i
];
}
}
}
bEndLoadChanges
=
true
;
bEndLoadChanges
=
true
;
onEndOpen
();
onEndOpen
();
...
@@ -331,6 +338,7 @@ function loadFileContent(url, callback) {
...
@@ -331,6 +338,7 @@ function loadFileContent(url, callback) {
});
});
});
});
}
else
{
}
else
{
oZipImages
=
null
;
bEndLoadChanges
=
true
;
bEndLoadChanges
=
true
;
}
}
...
...
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