...
 
Commits (9)
......@@ -732,6 +732,7 @@ onlyoffice/sdkjs/cell/model/DrawingObjects/GlobalCounters.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/Graphics.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/ShapeDrawer.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.xmla.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/databaseFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/dateandtimeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/engineeringFunctions.js\n
......@@ -1358,7 +1359,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>vincent</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -1372,7 +1373,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.55968.25998.221</string> </value>
<value> <string>965.1014.10748.13687</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -1390,7 +1391,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1516112122.46</float>
<float>1517243462.59</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -732,6 +732,7 @@ onlyoffice/sdkjs/cell/model/DrawingObjects/GlobalCounters.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/Graphics.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/ShapeDrawer.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.xmla.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/databaseFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/dateandtimeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/engineeringFunctions.js\n
......@@ -1358,7 +1359,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>vincent</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -1372,7 +1373,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.55968.49879.36266</string> </value>
<value> <string>965.1012.19255.29354</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -1390,7 +1391,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1516112135.45</float>
<float>1517243409.91</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -732,6 +732,7 @@ onlyoffice/sdkjs/cell/model/DrawingObjects/GlobalCounters.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/Graphics.js\n
onlyoffice/sdkjs/cell/model/DrawingObjects/ShapeDrawer.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.xmla.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/databaseFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/dateandtimeFunctions.js\n
onlyoffice/sdkjs/cell/model/FormulaObjects/engineeringFunctions.js\n
......@@ -1358,7 +1359,7 @@ NETWORK:\n
</item>
<item>
<key> <string>actor</string> </key>
<value> <string>vincent</string> </value>
<value> <string>zope</string> </value>
</item>
<item>
<key> <string>comment</string> </key>
......@@ -1372,7 +1373,7 @@ NETWORK:\n
</item>
<item>
<key> <string>serial</string> </key>
<value> <string>964.55968.37475.41574</string> </value>
<value> <string>965.1007.59634.37529</string> </value>
</item>
<item>
<key> <string>state</string> </key>
......@@ -1390,7 +1391,7 @@ NETWORK:\n
</tuple>
<state>
<tuple>
<float>1516112091.51</float>
<float>1517243378.3</float>
<string>UTC</string>
</tuple>
</state>
......
......@@ -517,6 +517,7 @@ onlyoffice/sdkjs/cell/model/DrawingObjects/GlobalCounters.js
onlyoffice/sdkjs/cell/model/DrawingObjects/Graphics.js
onlyoffice/sdkjs/cell/model/DrawingObjects/ShapeDrawer.js
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.js
onlyoffice/sdkjs/cell/model/FormulaObjects/cubeFunctions.xmla.js
onlyoffice/sdkjs/cell/model/FormulaObjects/databaseFunctions.js
onlyoffice/sdkjs/cell/model/FormulaObjects/dateandtimeFunctions.js
onlyoffice/sdkjs/cell/model/FormulaObjects/engineeringFunctions.js
......
/*global window, rJS, RSVP, DocsAPI, console, document,
Common, require, jIO, URL, FileReader, atob, ArrayBuffer,
Uint8Array, XMLHttpRequest, Blob, Rusha, define*/
Uint8Array, XMLHttpRequest, Blob, Rusha, define,
TextDecoder, DesktopOfflineAppDocumentEndSave*/
/*jslint nomen: true, maxlen:80, indent:2*/
"use strict";
if (Common === undefined) {
......@@ -54,7 +55,8 @@ DocsAPI.DocEditor.version = function () {
.ready(function (g) {
g.props = {
save_defer: null,
handlers: {}
handlers: {},
headerCaption: ""
};
})
.ready(function (g) {
......@@ -70,8 +72,8 @@ DocsAPI.DocEditor.version = function () {
.declareMethod("jio_getAttachment", function (docId, attId, opt) {
var g = this,
queue;
if (attId === 'body.txt') {
opt = 'asText';
if (attId === 'body.txt' || attId === 'Editor.bin') {
opt = 'asBinArray';
if (!docId) {
docId = '/';
}
......@@ -88,6 +90,11 @@ DocsAPI.DocEditor.version = function () {
.then(function (evt) {
return evt.target.result;
});
} else if (opt === "asBinArray") {
data = jIO.util.readBlobAsArrayBuffer(blob)
.then(function (evt) {
return new Uint8ClampedArray(evt.target.result);
});
} else if (opt === "asBlobURL") {
data = URL.createObjectURL(blob);
} else if (opt === "asDataURL") {
......@@ -175,6 +182,7 @@ DocsAPI.DocEditor.version = function () {
canCreateNew: false,
canAnalytics: false,
customization: {
autosave: false,
about: false,
feedback: false
}
......@@ -244,7 +252,7 @@ DocsAPI.DocEditor.version = function () {
return "";
})
.push(function (portal_type) {
var value, documentType, magic;
var value;
portal_type = portal_type || options.portal_type;
g.props.binary_loader = false;
g.props.jio_key = options.jio_key;
......@@ -274,27 +282,36 @@ DocsAPI.DocEditor.version = function () {
type: "zipfile",
file: value
});
return g.props.value_zip_storage.getAttachment('/', 'body.txt')
return g.jio_getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
throw 'not supported format of document: body.txt absent "' +
value.slice(0, 100) + '"';
return g.jio_getAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code === 404) {
throw 'not supported format of document:' +
' body.txt/Editor.bin absent "' +
value.slice(0, 100) + '"';
}
throw error;
});
}
throw error;
})
.push(jIO.util.readBlobAsText)
.push(function (evt) {
return evt.target.result;
});
}
}
})
.push(function (value) {
var documentType, magic;
g.props.value = value;
if (!g.props.documentType && value === "") {
throw "can not create empty document " +
"because portal_type is unknown";
}
if (value) {
magic = g.props.value.slice(0, 4);
magic = value.slice(0, 4);
if (typeof magic !== 'string') {
magic = String.fromCharCode.apply(null, magic);
}
switch (magic) {
case 'XLSY':
documentType = "spreadsheet";
......@@ -319,16 +336,25 @@ DocsAPI.DocEditor.version = function () {
}
})
.push(function () {
return jIO.util.ajax({
type: "GET",
url: "onlyoffice.gadget.appcache"
});
return new RSVP.Queue()
.push(function () {
return jIO.util.ajax({
type: "GET",
url: "onlyoffice.gadget.appcache"
});
})
.push(undefined, function (error) {
return;
});
})
.push(function (response) {
/*configure requeryjs for rename
view and edit to view_folder and edit_folder
in dependencies
*/
if (!response) {
return;
}
var text = response.target.responseText,
relative_url_list = text.split('\r\n'),
i,
......@@ -399,6 +425,7 @@ DocsAPI.DocEditor.version = function () {
if (g.props.binary_loader) {
g.props.base_url = "onlyoffice-bin/";
g.props.headerCaption = "BIN " + g.props.headerCaption;
} else {
g.props.base_url = "onlyoffice/";
define("sdk", sdk_deps, function () {
......@@ -424,27 +451,62 @@ DocsAPI.DocEditor.version = function () {
});
})
.declareMethod("jio_save", function (data) {
var g = this,
zip = g.props.value_zip_storage;
return new RSVP.Queue()
.push(function () {
if (data) {
return g.jio_putAttachment('/', 'body.txt', data)
.push(function () {
// cleanup if Editor.bin exist
return zip.removeAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code !== 404) {
throw error;
}
});
})
.push(undefined, function (error) {
display_error(g, error);
});
}
})
.push(function () {
if (g.props.save_defer) {
// if we are run from getContent
g.props.save_defer.resolve();
g.props.save_defer = null;
} else {
g.triggerSubmit();
}
});
})
.declareMethod('getContent', function () {
var g = this,
zip = g.props.value_zip_storage,
queue = new RSVP.Queue(),
save_defer = RSVP.defer();
g.props.save_defer = save_defer;
g.props.handlers.save();
queue = new RSVP.Queue();
if (g.props.handlers.save()) {
g.props.save_defer = RSVP.defer();
}
return queue.push(function () {
return save_defer.promise;
if (g.props.save_defer) {
return g.props.save_defer.promise;
}
})
.push(function (data) {
if (data) {
var body = data[g.props.key];
return zip.putAttachment('/', 'body.txt', body);
}
})
.push(function () {
return zip.getAttachment('/', 'body.txt')
// prevent save empty zip archive
// check document exist in archive
return zip.getAttachment('/', 'Editor.bin')
.push(undefined, function (error) {
if (error.status_code === 404) {
return "";
return zip.getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error.status_code === 404) {
return "";
}
throw error;
});
}
throw error;
});
......@@ -462,6 +524,10 @@ DocsAPI.DocEditor.version = function () {
.push(function (evt) {
var data = {};
data[g.props.key] = evt.target.result;
// TODO it should be run on state change
// if fail send int:1
// it clear modification state onlyoffice
DesktopOfflineAppDocumentEndSave(0);
return data;
});
});
......
......@@ -105,7 +105,7 @@
"../cell/model/FormulaObjects/xlfnFunctions.js",
"../cell/model/FormulaObjects/dateandtimeFunctions.js",
"../cell/model/FormulaObjects/engineeringFunctions.js",
"../cell/model/FormulaObjects/cubeFunctions.js",
"../cell/model/FormulaObjects/cubeFunctions.xmla.js",
"../cell/model/FormulaObjects/databaseFunctions.js",
"../cell/model/FormulaObjects/textanddataFunctions.js",
"../cell/model/FormulaObjects/statisticalFunctions.js",
......
......@@ -1064,7 +1064,14 @@ var editor;
}).then(resolve, reject);
};
if (opt_url) {
AscCommon.getJSZipUtils().getBinaryContent(opt_url, processData);
Common.Gateway.jio_getAttachment('/', 'Editor.xlsx')
.push(undefined, function (err) {
resolve();
})
.push(function (data) {
processData(undefined, data);
});
// AscCommon.getJSZipUtils().getBinaryContent(opt_url, processData);
} else {
processData(undefined, undefined, opt_path);
}
......@@ -3295,9 +3302,6 @@ var editor;
var oBinaryFileWriter = new AscCommonExcel.BinaryFileWriter(this.wbModel);
oBinaryFileWriter.Write(undefined, true);
var _header = oBinaryFileWriter.WriteFileHeader(oBinaryFileWriter.Memory.GetCurPosition(), Asc.c_nVersionNoBase64);
window["native"]["Save_End"](_header, oBinaryFileWriter.Memory.GetCurPosition());
return oBinaryFileWriter.Memory.ImData.data;
};
......
<?xml version="1.0"?>
<ZopeData>
<record id="1" aka="AAAAAAAAAAE=">
<pickle>
<global name="File" module="OFS.Image"/>
</pickle>
<pickle>
<dictionary>
<item>
<key> <string>_Cacheable__manager_id</string> </key>
<value> <string>http_cache</string> </value>
</item>
<item>
<key> <string>__name__</string> </key>
<value> <string>cubeFunctions.xmla.js</string> </value>
</item>
<item>
<key> <string>content_type</string> </key>
<value> <string>text/javascript</string> </value>
</item>
<item>
<key> <string>precondition</string> </key>
<value> <string></string> </value>
</item>
<item>
<key> <string>title</string> </key>
<value> <string></string> </value>
</item>
</dictionary>
</pickle>
</record>
</ZopeData>
......@@ -276,50 +276,28 @@ AscCommon.downloadUrlAsBlob = function (url) {
AscCommon.baseEditorsApi.prototype.jio_open = function () {
var t = this,
g = Common.Gateway;
return g.jio_getAttachment('/', 'body.txt')
.push(undefined, function (error) {
if (error["status_code"] === 404) {
return g.props.value;
}
throw error;
})
.push(function (doc) {
if (!doc) {
switch (g.props.documentType) {
case "presentation":
doc = t.getEmpty();
break;
case "spreadsheet":
doc = "XLSY;v2;2286;BAKAAgAAA+cHAAAEAwgAAADqCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAYEAAAAAAcEAAAAAAgEAAAAAAkEpAAAAAwEAAAAAA0GGAAAAAABBAEEAAAAAAUBAAYEAAAAAAcBAAgBAA8qAQAAECkAAAAABAAAAAAAAAABAQAAAAAEDAAAAE4AbwByAG0AYQBsAAUEAAAAAAAAABAnAAAAAAQAAAADAAAAAQEAAAAABAoAAABDAG8AbQBtAGEABQQAAAAPAAAAEC8AAAAABAAAAAYAAAABAQAAAAAEEgAAAEMAbwBtAG0AYQAgAFsAMABdAAUEAAAAEAAAABAtAAAAAAQAAAAEAAAAAQEAAAAABBAAAABDAHUAcgByAGUAbgBjAHkABQQAAAARAAAAEDUAAAAABAAAAAcAAAABAQAAAAAEGAAAAEMAdQByAHIAZQBuAGMAeQAgAFsAMABdAAUEAAAAEgAAABArAAAAAAQAAAAFAAAAAQEAAAAABA4AAABQAGUAcgBjAGUAbgB0AAUEAAAAEwAAABgAAAAAAwAAAAEBAAELAAAAAgYAAAAABAAAAADjAAAAAN4AAAABGwAAAAAGDAAAAFMAaABlAGUAdAAxAAEEAQAAAAIBAgIkAAAAAx8AAAABAQACBAEEAAADBAEAAAAEBAAAAAAFBXnalahdiStABAQAAABBADEAFhEAAAAXDAAAAAQBAAAAAQYBAAAAAQsKAAAAAQWamZmZmZkpQA48AAAAAAVxPQrXowA0QAEFKFyPwvUIOkACBXE9CtejADRAAwUoXI/C9Qg6QAQFcT0K16MANEAFBXE9CtejADRADwYAAAAAAQEBAQkQBgAAAAABAQEBAAkAAAAAGAYAAAACAQAAAAAAAAAA";
break;
case "text":
doc = window.g_sEmpty_bin;
break;
}
}
t._OfflineAppDocumentEndLoad('', doc);
})
.push(undefined, function (error) {
console.log(error);
});
g = Common.Gateway,
doc = g.props.value;
if (!doc) {
switch (g.props.documentType) {
case "presentation":
doc = t.getEmpty();
break;
case "spreadsheet":
doc = "XLSY;v2;2286;BAKAAgAAA+cHAAAEAwgAAADqCAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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JAAAAAkoAAAADRQAAAAABAAEBAAMBAAYEAAAAAAcEAAAAAAgEAAAAAAkEpAAAAAwEAAAAAA0GGAAAAAABBAEEAAAAAAUBAAYEAAAAAAcBAAgBAA8qAQAAECkAAAAABAAAAAAAAAABAQAAAAAEDAAAAE4AbwByAG0AYQBsAAUEAAAAAAAAABAnAAAAAAQAAAADAAAAAQEAAAAABAoAAABDAG8AbQBtAGEABQQAAAAPAAAAEC8AAAAABAAAAAYAAAABAQAAAAAEEgAAAEMAbwBtAG0AYQAgAFsAMABdAAUEAAAAEAAAABAtAAAAAAQAAAAEAAAAAQEAAAAABBAAAABDAHUAcgByAGUAbgBjAHkABQQAAAARAAAAEDUAAAAABAAAAAcAAAABAQAAAAAEGAAAAEMAdQByAHIAZQBuAGMAeQAgAFsAMABdAAUEAAAAEgAAABArAAAAAAQAAAAFAAAAAQEAAAAABA4AAABQAGUAcgBjAGUAbgB0AAUEAAAAEwAAABgAAAAAAwAAAAEBAAELAAAAAgYAAAAABAAAAADjAAAAAN4AAAABGwAAAAAGDAAAAFMAaABlAGUAdAAxAAEEAQAAAAIBAgIkAAAAAx8AAAABAQACBAEEAAADBAEAAAAEBAAAAAAFBXnalahdiStABAQAAABBADEAFhEAAAAXDAAAAAQBAAAAAQYBAAAAAQsKAAAAAQWamZmZmZkpQA48AAAAAAVxPQrXowA0QAEFKFyPwvUIOkACBXE9CtejADRAAwUoXI/C9Qg6QAQFcT0K16MANEAFBXE9CtejADRADwYAAAAAAQEBAQkQBgAAAAABAQEBAAkAAAAAGAYAAAACAQAAAAAAAAAA";
break;
case "text":
doc = window.g_sEmpty_bin;
break;
}
}
t._OfflineAppDocumentEndLoad('', doc);
};
AscCommon.baseEditorsApi.prototype.jio_save = function () {
var t = this,
g = Common.Gateway,
result = {},
data = t.asc_nativeGetFile();
if (g.props.save_defer) {
// if we are run from getContent
result[g.props.key] = data;
g.props.save_defer.resolve(result);
g.props.save_defer = null;
} else {
// TODO: rewrite to put_attachment
return g.jio_putAttachment('/', 'body.txt', data)
.push(undefined, function (error) {
console.log(error);
});
}
// data = t.asc_nativeGetFile(); // base64 file
data = new Blob([t.asc_nativeGetFileData()]); // binary file
return g.jio_save(data);
};
\ No newline at end of file
......@@ -49,16 +49,16 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true;
return this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _binary)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
if (_binary == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return;
}
this.OpenDocument2(_url, _data);
this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
this.DocumentOrientation = (null == this.WordControl.m_oLogicDocument) ? true : !this.WordControl.m_oLogicDocument.Orientation;
DesktopOfflineUpdateLocalName(this);
......
......@@ -6704,9 +6704,6 @@ background-repeat: no-repeat;\
this.WordControl.m_oLogicDocument.CalculateComments();
writer.WriteDocument3(this.WordControl.m_oLogicDocument);
var _header = "PPTY;v10;" + writer.pos + ";";
window["native"]["Save_End"](_header, writer.pos);
return writer.ImData.data;
};
......
......@@ -49,21 +49,26 @@ Asc['asc_docs_api'].prototype._OfflineAppDocumentStartLoad = function()
AscCommon.History.UserSaveMode = true;
return this.jio_open();
};
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _data)
Asc['asc_docs_api'].prototype._OfflineAppDocumentEndLoad = function(_url, _binary)
{
//AscCommon.g_oIdCounter.m_sUserId = window["AscDesktopEditor"]["CheckUserId"]();
if (_data == "")
if (_binary == "")
{
this.sendEvent("asc_onError", c_oAscError.ID.ConvertationOpenError, c_oAscError.Level.Critical);
return;
}
if (AscCommon.c_oSerFormat.Signature !== _data.substring(0, AscCommon.c_oSerFormat.Signature.length))
var _sign_len = AscCommon.c_oSerFormat.Signature.length;
var _signature = _binary.slice(0, _sign_len);
if (typeof _signature !== 'string') {
_signature = String.fromCharCode.apply(null, _signature);
}
if (AscCommon.c_oSerFormat.Signature !== _signature)
{
this.OpenDocument(_url, _data);
this.OpenDocument(_url, _binary);
}
else
else
{
this.OpenDocument2(_url, _data);
this.OpenDocument2(_url, _binary);
this.WordControl.m_oLogicDocument.Set_FastCollaborativeEditing(false);
}
DesktopOfflineUpdateLocalName(this);
......
......@@ -7985,9 +7985,6 @@ background-repeat: no-repeat;\
oBinaryFileWriter.Write(true);
var _header = AscCommon.c_oSerFormat.Signature + ";v" + Asc.c_nVersionNoBase64 + ";" + _memory.GetCurPosition() + ";";
window["native"]["Save_End"](_header, _memory.GetCurPosition());
return _memory.ImData.data;
};
......
......@@ -142,12 +142,13 @@ define([
},
setHeaderCaption: function(value) {
this.headerCaption = value;
this.headerCaption = Common.Gateway.props.headerCaption +
value;
var caption = $('#header-caption > div');
if (caption)
caption.html(value);
caption.html(this.headerCaption);
return value;
},
......
......@@ -862,7 +862,7 @@ define([
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
me.updatePlugins(me.plugins, false);
else
me.requestPlugins('../../../../plugins.json');
me.requestPlugins();
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
documentHolderController.setApi(me.api);
......@@ -933,12 +933,9 @@ define([
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('refreshhistory', _.bind(me.onRefreshHistory, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
......@@ -258,7 +258,7 @@ define([
} else if (this.mode.canDownloadOrigin)
$('a',this.items[3].$el).text(this.textDownload);
this.panels['help'].setLangConfig(this.mode.lang);
// this.panels['help'].setLangConfig(this.mode.lang);
this.items[11][this.mode.canUseHistory&&!this.mode.isDisconnected?'show':'hide']();
},
......
......@@ -147,7 +147,7 @@ define([
if (this.api){
this.api.SetDrawingFreeze(true);
this.api.SetThemesPath("../../../../sdkjs/slide/themes/");
this.api.SetThemesPath("onlyoffice/sdkjs/slide/themes/");
this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this));
this.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(this.onDocumentContentReady, this));
......@@ -640,7 +640,7 @@ define([
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
me.updatePlugins(me.plugins, false);
else
me.requestPlugins('../../../../plugins.json');
me.requestPlugins();
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
documentHolderController.setApi(me.api);
......@@ -713,12 +713,9 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
......@@ -250,7 +250,7 @@ define([
this.$el.find('#fm-btn-create, #fm-btn-back, #fm-btn-create+.devider').hide();
}
this.panels['help'].setLangConfig(this.mode.lang);
// this.panels['help'].setLangConfig(this.mode.lang);
},
setMode: function(mode, delay) {
......
......@@ -621,7 +621,7 @@ define([
if (me.plugins && me.plugins.pluginsData && me.plugins.pluginsData.length>0)
me.updatePlugins(me.plugins, false);
else
me.requestPlugins('../../../../plugins.json');
me.requestPlugins();
me.api.asc_registerCallback('asc_onPluginsInit', _.bind(me.updatePluginsList, me));
}
......@@ -716,12 +716,9 @@ define([
Common.Gateway.on('processrightschange', _.bind(me.onProcessRightsChange, me));
Common.Gateway.on('processmouse', _.bind(me.onProcessMouse, me));
Common.Gateway.on('save', function () {
var g = Common.Gateway;
if (me.api.asc_isDocumentModified()) {
me.api.asc_Save();
}
if (g.props.save_defer) {
g.props.save_defer.resolve(undefined);
return true;
}
});
Common.Gateway.on('downloadas', _.bind(me.onDownloadAs, me));
......
......@@ -233,7 +233,7 @@ define([
}
}
this.panels['help'].setLangConfig(this.mode.lang);
// this.panels['help'].setLangConfig(this.mode.lang);
},
setMode: function(mode, delay) {
......