Commit 260331cb authored by konovalovsergey's avatar konovalovsergey

asc_nativeOpenFile pivot

parent d2da301d
...@@ -954,7 +954,7 @@ var editor; ...@@ -954,7 +954,7 @@ var editor;
} }
} }
this.wbModel = this._openDocument(sData); this.wbModel = this._openDocument(sData);
this.openDocumentFromZip(this.wbModel).then(function() { this.openDocumentFromZip(this.wbModel, AscCommon.g_oDocumentUrls.getUrl('Editor.xlsx')).then(function() {
t.FontLoader.LoadDocumentFonts(t.wbModel.generateFontMap2()); t.FontLoader.LoadDocumentFonts(t.wbModel.generateFontMap2());
// Какая-то непонятная заглушка, чтобы не падало в ipad // Какая-то непонятная заглушка, чтобы не падало в ipad
...@@ -970,18 +970,16 @@ var editor; ...@@ -970,18 +970,16 @@ 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) { spreadsheet_api.prototype.openDocumentFromZip = function (wb, url) {
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;
//open cache xlsx instead of documentUrl, to support pivot in xls, ods... and don't send jwt signature //open cache xlsx instead of documentUrl, to support pivot in xls, ods... and don't send jwt signature
var url = AscCommon.g_oDocumentUrls.getUrl('Editor.xlsx');
if (t.isChartEditor && url) { if (t.isChartEditor && url) {
resolve(); resolve();
return; return;
} }
var processData = function (err, data) {
require('jsziputils').getBinaryContent(url, function (err, data) {
if (err) { if (err) {
reject(err); // or handle err reject(err); // or handle err
} else { } else {
...@@ -1072,7 +1070,12 @@ var editor; ...@@ -1072,7 +1070,12 @@ var editor;
return Asc.ReadDefTableStyles(wb); return Asc.ReadDefTableStyles(wb);
}).then(resolve, reject); }).then(resolve, reject);
} }
}); };
if (typeof url === "string") {
require('jsziputils').getBinaryContent(url, processData);
} else {
processData(undefined, url);
}
}); });
}; };
...@@ -3289,7 +3292,7 @@ var editor; ...@@ -3289,7 +3292,7 @@ var editor;
} }
}; };
spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File, version, isUser) { spreadsheet_api.prototype.asc_nativeOpenFile = function(base64File, version, isUser, xlsxFile) {
asc["editor"] = this; asc["editor"] = this;
this.SpellCheckUrl = ''; this.SpellCheckUrl = '';
...@@ -3310,9 +3313,10 @@ var editor; ...@@ -3310,9 +3313,10 @@ 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() {
this._coAuthoringInit(); this._coAuthoringInit();
this.wb = new AscCommonExcel.WorkbookView(this.wbModel, this.controller, this.handlers, window["_null_object"], window["_null_object"], this, this.collaborativeEditing, this.fontRenderingMode); this.wb = new AscCommonExcel.WorkbookView(this.wbModel, this.controller, this.handlers, window["_null_object"], window["_null_object"], this, this.collaborativeEditing, this.fontRenderingMode);
});
}; };
spreadsheet_api.prototype.asc_nativeCalculateFile = function() { spreadsheet_api.prototype.asc_nativeCalculateFile = function() {
......
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