Commit 1ea578d4 authored by konovalovsergey's avatar konovalovsergey

openDocumentFromZip add path param

parent d665d419
...@@ -970,7 +970,7 @@ var editor; ...@@ -970,7 +970,7 @@ var editor;
t.sendEvent('asc_onError', c_oAscError.ID.Unknown, c_oAscError.Level.Critical); t.sendEvent('asc_onError', c_oAscError.ID.Unknown, c_oAscError.Level.Critical);
}); });
}; };
spreadsheet_api.prototype.openDocumentFromZip = function (wb, url) { spreadsheet_api.prototype.openDocumentFromZip = function (wb, opt_url, opt_path) {
var t = this; var t = this;
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
var openXml = AscCommon.openXml; var openXml = AscCommon.openXml;
...@@ -979,15 +979,15 @@ var editor; ...@@ -979,15 +979,15 @@ var editor;
resolve(); resolve();
return; return;
} }
var processData = function (err, data) { var processData = function (err, data, path) {
var nextPromise; var nextPromise;
if (!err && data) { if (!err && (data || path)) {
openXml.SaxParserDataTransfer.wb = wb; openXml.SaxParserDataTransfer.wb = wb;
var doc = new openXml.OpenXmlPackage(); var doc = new openXml.OpenXmlPackage();
var wbPart = null; var wbPart = null;
var wbXml = null; var wbXml = null;
var jsZipWrapper = new AscCommon.JSZipWrapper(); var jsZipWrapper = new AscCommon.JSZipWrapper();
nextPromise = jsZipWrapper.loadAsync(data).then(function (zip) { nextPromise = jsZipWrapper.loadAsync(data || path).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);
...@@ -1081,10 +1081,10 @@ var editor; ...@@ -1081,10 +1081,10 @@ var editor;
return Asc.ReadDefTableStyles(wb); return Asc.ReadDefTableStyles(wb);
}).then(resolve, reject); }).then(resolve, reject);
}; };
if (typeof url === "string") { if (opt_url) {
AscCommon.getJSZipUtils().getBinaryContent(url, processData); AscCommon.getJSZipUtils().getBinaryContent(opt_url, processData);
} else { } else {
processData(undefined, url); processData(undefined, undefined, opt_path);
} }
}); });
}; };
...@@ -3302,7 +3302,7 @@ var editor; ...@@ -3302,7 +3302,7 @@ var editor;
} }
}; };
spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File, version, isUser, xlsxFile) { spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File, version, isUser, xlsxPath) {
var t = this; var t = this;
asc["editor"] = this; asc["editor"] = this;
...@@ -3324,11 +3324,12 @@ var editor; ...@@ -3324,11 +3324,12 @@ var editor;
} }
oBinaryFileReader.Read(base64File, this.wbModel); oBinaryFileReader.Read(base64File, this.wbModel);
g_oIdCounter.Set_Load(false); g_oIdCounter.Set_Load(false);
this.openDocumentFromZip(this.wbModel, xlsxFile).then(function() { var thenCallback = function() {
});
t._coAuthoringInit(); t._coAuthoringInit();
t.wb = new AscCommonExcel.WorkbookView(t.wbModel, t.controller, t.handlers, window["_null_object"], window["_null_object"], t, t.collaborativeEditing, t.fontRenderingMode); t.wb = new AscCommonExcel.WorkbookView(t.wbModel, t.controller, t.handlers, window["_null_object"], window["_null_object"], t, t.collaborativeEditing, t.fontRenderingMode);
}; };
return this.openDocumentFromZip(this.wbModel, undefined, xlsxPath).then(thenCallback, thenCallback);
};
spreadsheet_api.prototype.asc_nativeCalculateFile = function() { spreadsheet_api.prototype.asc_nativeCalculateFile = function() {
window['DoctRendererMode'] = true; window['DoctRendererMode'] = true;
......
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