Commit 97f56e75 authored by Alexander.Trofimov's avatar Alexander.Trofimov

fix load externs

parent c33278c7
......@@ -986,7 +986,7 @@ var editor;
var doc = new openXml.OpenXmlPackage();
var wbPart = null;
var wbXml = null;
nextPromise = JSZip.loadAsync(data).then(function (zip) {
nextPromise = AscCommon.getJSZip().loadAsync(data).then(function (zip) {
return doc.openFromZip(zip);
}).then(function () {
wbPart = doc.getPartByRelationshipType(openXml.relationshipTypes.workbook);
......@@ -1079,7 +1079,7 @@ var editor;
}).then(resolve, reject);
};
if (typeof url === "string") {
JSZipUtils.getBinaryContent(url, processData);
AscCommon.getJSZipUtils().getBinaryContent(url, processData);
} else {
processData(undefined, url);
}
......
This diff is collapsed.
......@@ -1524,7 +1524,7 @@
} else {
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
sockjs = this.sockjs = new (this._getSockJs())(this.sockjs_url, null, {'transports': ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
sockjs = this.sockjs = new (AscCommon.getSockJs())(this.sockjs_url, null, {'transports': ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
}
sockjs.onopen = function() {
......@@ -1651,10 +1651,6 @@
};
DocsCoApi.prototype._getSockJs = function() {
return window['SockJS'] ? window['SockJS'] : require('sockjs');
};
DocsCoApi.prototype._getDisconnectErrorCode = function(opt_closeCode) {
if (c_oCloseCode.serverShutdown === opt_closeCode) {
return Asc.c_oAscError.ID.CoAuthoringDisconnect;
......
......@@ -132,20 +132,9 @@
return false;
};
if (typeof require === 'function')
if (typeof require === 'function' && !window['XRegExp'])
{
if (!window['XRegExp'])
{
window['XRegExp'] = require('xregexp');
}
if (!window['JSZipUtils'])
{
window['JSZipUtils'] = require('jsziputils');
}
if (!window['JSZip'])
{
window['JSZip'] = require('jszip');
}
window['XRegExp'] = require('xregexp');
}
var oZipImages = null;
......@@ -154,6 +143,19 @@
var sUploadServiceLocalUrlOld = "../../../../uploadold";
var nMaxRequestLength = 5242880;//5mb <requestLimits maxAllowedContentLength="30000000" /> default 30mb
function getSockJs()
{
return window['SockJS'] || require('sockjs');
}
function getJSZipUtils()
{
return window['JSZipUtils'] || require('jsziputils');
}
function getJSZip()
{
return window['JSZip'] || require('jszip');
}
function getBaseUrl()
{
var indexHtml = window["location"]["href"];
......@@ -438,7 +440,7 @@
if (changesUrl)
{
oZipImages = {};
JSZipUtils.getBinaryContent(changesUrl, function (err, data)
getJSZipUtils().getBinaryContent(changesUrl, function (err, data)
{
if (err)
{
......@@ -449,7 +451,7 @@
}
oResult.changes = [];
JSZip.loadAsync(data).then(function (zipChanges)
getJSZip().loadAsync(data).then(function (zipChanges)
{
var relativePaths = [];
var promises = [];
......@@ -3070,6 +3072,9 @@
//------------------------------------------------------------export---------------------------------------------------
window['AscCommon'] = window['AscCommon'] || {};
window["AscCommon"].getSockJs = getSockJs;
window["AscCommon"].getJSZipUtils = getJSZipUtils;
window["AscCommon"].getJSZip = getJSZip;
window["AscCommon"].getBaseUrl = getBaseUrl;
window["AscCommon"].getEncodingParams = getEncodingParams;
window["AscCommon"].saveWithParts = saveWithParts;
......
......@@ -189,7 +189,7 @@
function initSocksJs(url, docsCoApi) {
//ограничиваем transports WebSocket и XHR / JSONP polling, как и engine.io https://github.com/socketio/engine.io
//при переборе streaming transports у клиента с wirewall происходило зацикливание(не повторялось в версии sock.js 0.3.4)
var sockjs = new (_getSockJs())(url, null,
var sockjs = new (AscCommon.getSockJs())(url, null,
{'transports': ['websocket', 'xdr-polling', 'xhr-polling', 'iframe-xhr-polling', 'jsonp-polling']});
sockjs.onopen = function () {
......@@ -253,10 +253,6 @@
return sockjs;
}
function _getSockJs() {
return window['SockJS'] ? window['SockJS'] : require('sockjs');
}
SpellCheckApi.prototype.init = function (docid) {
this._docid = docid;
var re = /^https?:\/\//;
......
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