Commit a0fcd00a authored by konovalovsergey's avatar konovalovsergey

JSZipWrapper

parent a1f69b25
...@@ -986,7 +986,8 @@ var editor; ...@@ -986,7 +986,8 @@ var editor;
var doc = new openXml.OpenXmlPackage(); var doc = new openXml.OpenXmlPackage();
var wbPart = null; var wbPart = null;
var wbXml = null; var wbXml = null;
nextPromise = AscCommon.getJSZip().loadAsync(data).then(function (zip) { var jsZipWrapper = new AscCommon.JSZipWrapper();
nextPromise = jsZipWrapper.loadAsync(data).then(function (zip) {
return doc.openFromZip(zip); return doc.openFromZip(zip);
}).then(function () { }).then(function () {
wbPart = doc.getPartByRelationshipType(openXml.relationshipTypes.workbook); wbPart = doc.getPartByRelationshipType(openXml.relationshipTypes.workbook);
...@@ -1063,6 +1064,8 @@ var editor; ...@@ -1063,6 +1064,8 @@ var editor;
if (window.console && window.console.log) { if (window.console && window.console.log) {
window.console.log(err); window.console.log(err);
} }
}).then(function () {
jsZipWrapper.close();
}); });
} else { } else {
if (err) { if (err) {
......
This diff is collapsed.
...@@ -156,6 +156,29 @@ ...@@ -156,6 +156,29 @@
return window['JSZip'] || require('jszip'); return window['JSZip'] || require('jszip');
} }
function JSZipWrapper() {
this.files = {};
}
JSZipWrapper.prototype.loadAsync = function(data, options) {
var t = this;
return AscCommon.getJSZip().loadAsync(data, options).then(function(zip){
for (var id in zip.files) {
t.files[id] = new JSZipObjectWrapper(zip.files[id]);
}
return t;
});
};
JSZipWrapper.prototype.close = function() {
};
function JSZipObjectWrapper(data) {
this.data = data;
}
JSZipObjectWrapper.prototype.async = function(type) {
return this.data.async(type);
};
function getBaseUrl() function getBaseUrl()
{ {
var indexHtml = window["location"]["href"]; var indexHtml = window["location"]["href"];
...@@ -3121,6 +3144,7 @@ ...@@ -3121,6 +3144,7 @@
window["AscCommon"].getAltGr = getAltGr; window["AscCommon"].getAltGr = getAltGr;
window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex; window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex;
window["AscCommon"].JSZipWrapper = JSZipWrapper;
window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls; window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls;
window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo; window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo;
window["AscCommon"].cBoolLocal = cBoolLocal; window["AscCommon"].cBoolLocal = cBoolLocal;
......
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