Commit a0fcd00a authored by konovalovsergey's avatar konovalovsergey

JSZipWrapper

parent a1f69b25
......@@ -986,7 +986,8 @@ var editor;
var doc = new openXml.OpenXmlPackage();
var wbPart = 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);
}).then(function () {
wbPart = doc.getPartByRelationshipType(openXml.relationshipTypes.workbook);
......@@ -1063,6 +1064,8 @@ var editor;
if (window.console && window.console.log) {
window.console.log(err);
}
}).then(function () {
jsZipWrapper.close();
});
} else {
if (err) {
......
This diff is collapsed.
......@@ -156,6 +156,29 @@
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()
{
var indexHtml = window["location"]["href"];
......@@ -3121,6 +3144,7 @@
window["AscCommon"].getAltGr = getAltGr;
window["AscCommon"].getColorThemeByIndex = getColorThemeByIndex;
window["AscCommon"].JSZipWrapper = JSZipWrapper;
window["AscCommon"].g_oDocumentUrls = g_oDocumentUrls;
window["AscCommon"].FormulaTablePartInfo = FormulaTablePartInfo;
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