mirror of
https://github.com/ONLYOFFICE/sdkjs.git
synced 2026-04-07 14:09:12 +08:00
Feature/mobile bugs (#3306)
* Refactoring * Hotfix/v7.3.1 (#3304) * [de] Fix bug 60892 * [oform] Add methods to generate objects id for oform * [oform] Work with oform classes depending on Addon.forms flag * [oform] Add an option to config to deactivate oform module * [oform] Fix deactivating oform module --------- Co-authored-by: papacarlo <builder@onlyoffice.com> Co-authored-by: Igor Zotov <Igor.Zotov@onlyoffice.com> Co-authored-by: KirillovIlya <ilya.kirillov@onlyoffice.com> * Fix typo --------- Co-authored-by: papacarlo <builder@onlyoffice.com> Co-authored-by: Igor Zotov <Igor.Zotov@onlyoffice.com> Co-authored-by: KirillovIlya <ilya.kirillov@onlyoffice.com>
This commit is contained in:
@ -6429,30 +6429,31 @@ window["native"]["offline_apply_event"] = function(type,params) {
|
||||
|
||||
case 10000: // ASC_SOCKET_EVENT_TYPE_OPEN
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._onServerOpen();
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("connect");
|
||||
break;
|
||||
}
|
||||
|
||||
case 10010: // ASC_SOCKET_EVENT_TYPE_ON_CLOSE
|
||||
{
|
||||
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
|
||||
case 10020: // ASC_SOCKET_EVENT_TYPE_MESSAGE
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._onServerMessage(params ? JSON.parse(params) : {});
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("message", params ? JSON.parse(params) : {});
|
||||
break;
|
||||
}
|
||||
|
||||
case 11010: // ASC_SOCKET_EVENT_TYPE_ON_DISCONNECT
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("disconnect", params || "");
|
||||
break;
|
||||
}
|
||||
|
||||
case 11020: // ASC_SOCKET_EVENT_TYPE_TRY_RECONNECT
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._reconnect();
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -2478,30 +2478,31 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
|
||||
|
||||
case 10000: // ASC_SOCKET_EVENT_TYPE_OPEN
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._onServerOpen();
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("connect");
|
||||
break;
|
||||
}
|
||||
|
||||
case 10010: // ASC_SOCKET_EVENT_TYPE_ON_CLOSE
|
||||
{
|
||||
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
|
||||
case 10020: // ASC_SOCKET_EVENT_TYPE_MESSAGE
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._onServerMessage(_params ? JSON.parse(_params) : {});
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("message", _params ? JSON.parse(_params) : {});
|
||||
break;
|
||||
}
|
||||
|
||||
case 11010: // ASC_SOCKET_EVENT_TYPE_ON_DISCONNECT
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("disconnect", _params || "");
|
||||
break;
|
||||
}
|
||||
|
||||
case 11020: // ASC_SOCKET_EVENT_TYPE_TRY_RECONNECT
|
||||
{
|
||||
_api.CoAuthoringApi._CoAuthoringApi._reconnect();
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@ -1762,6 +1762,8 @@
|
||||
this.settings = settings;
|
||||
this.io = this;
|
||||
this.settings["type"] = "socketio";
|
||||
|
||||
this.events = {};
|
||||
}
|
||||
CNativeSocket.prototype.open = function() { return this.engine.open(this.settings); };
|
||||
CNativeSocket.prototype.send = function(message) { return this.engine.send(message); };
|
||||
@ -1773,6 +1775,22 @@
|
||||
CNativeSocket.prototype.reconnectionDelayMax = function(val) { this.settings["reconnectionDelayMax"] = val; };
|
||||
CNativeSocket.prototype.randomizationFactor = function(val) { this.settings["randomizationFactor"] = val; };
|
||||
|
||||
CNativeSocket.prototype.on = function(name, callback) {
|
||||
if (!this.events.hasOwnProperty(name))
|
||||
this.events[name] = [];
|
||||
this.events[name].push(callback);
|
||||
};
|
||||
CNativeSocket.prototype.onMessage = function() {
|
||||
var name = arguments[0];
|
||||
if (this.events.hasOwnProperty(name))
|
||||
{
|
||||
for (var i = 0; i < this.events[name].length; ++i)
|
||||
this.events[name][i].apply(this, Array.prototype.slice.call(arguments, 1));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
DocsCoApi.prototype._initSocksJs = function () {
|
||||
var t = this;
|
||||
let socket;
|
||||
@ -1794,38 +1812,37 @@
|
||||
} else {
|
||||
let io = AscCommon.getSocketIO();
|
||||
socket = io(options);
|
||||
socket.on("connect", function () {
|
||||
t._onServerOpen();
|
||||
});
|
||||
socket.on("disconnect", function (reason) {
|
||||
//(explicit disconnection), the client will not try to reconnect and you need to manually call
|
||||
let explicit = 'io server disconnect' === reason || 'io client disconnect' === reason;
|
||||
t._onServerClose(explicit);
|
||||
if (!explicit) {
|
||||
//explicit disconnect sends disconnect reason on its own
|
||||
t.onDisconnect();
|
||||
}
|
||||
});
|
||||
socket.on('connect_error', function (err) {
|
||||
//cases: every connect error and reconnect
|
||||
if (err.data) {
|
||||
//cases: authorization
|
||||
t._onServerClose(true);
|
||||
t.onDisconnect(err.data.description, err.data.code);
|
||||
}
|
||||
});
|
||||
socket.io.on("reconnect_failed", function () {
|
||||
//cases: connection restore, wrong socketio_url
|
||||
t._onServerClose(true);
|
||||
t.onDisconnect("reconnect_failed", c_oCloseCode.restore);
|
||||
});
|
||||
socket.on("message", function (data) {
|
||||
t._onServerMessage(data);
|
||||
});
|
||||
}
|
||||
this.socketio = socket;
|
||||
|
||||
return socket;
|
||||
socket.on("connect", function () {
|
||||
t._onServerOpen();
|
||||
});
|
||||
socket.on("disconnect", function (reason) {
|
||||
//(explicit disconnection), the client will not try to reconnect and you need to manually call
|
||||
let explicit = 'io server disconnect' === reason || 'io client disconnect' === reason;
|
||||
t._onServerClose(explicit);
|
||||
if (!explicit) {
|
||||
//explicit disconnect sends disconnect reason on its own
|
||||
t.onDisconnect();
|
||||
}
|
||||
});
|
||||
socket.on('connect_error', function (err) {
|
||||
//cases: every connect error and reconnect
|
||||
if (err.data) {
|
||||
//cases: authorization
|
||||
t._onServerClose(true);
|
||||
t.onDisconnect(err.data.description, err.data.code);
|
||||
}
|
||||
});
|
||||
socket.io.on("reconnect_failed", function () {
|
||||
//cases: connection restore, wrong socketio_url
|
||||
t._onServerClose(true);
|
||||
t.onDisconnect("reconnect_failed", c_oCloseCode.restore);
|
||||
});
|
||||
socket.on("message", function (data) {
|
||||
t._onServerMessage(data);
|
||||
});
|
||||
this.socketio = socket;
|
||||
return socket;
|
||||
};
|
||||
|
||||
DocsCoApi.prototype._onServerOpen = function () {
|
||||
|
||||
@ -1431,30 +1431,31 @@ Asc['asc_docs_api'].prototype["Call_Menu_Event"] = function(type, _params)
|
||||
|
||||
case 10000: // ASC_SOCKET_EVENT_TYPE_OPEN
|
||||
{
|
||||
this.CoAuthoringApi._CoAuthoringApi._onServerOpen();
|
||||
this.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("connect");
|
||||
break;
|
||||
}
|
||||
|
||||
case 10010: // ASC_SOCKET_EVENT_TYPE_ON_CLOSE
|
||||
{
|
||||
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
|
||||
case 10020: // ASC_SOCKET_EVENT_TYPE_MESSAGE
|
||||
{
|
||||
this.CoAuthoringApi._CoAuthoringApi._onServerMessage(_params ? JSON.parse(_params) : {});
|
||||
this.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("message", _params ? JSON.parse(_params) : {});
|
||||
break;
|
||||
}
|
||||
|
||||
case 11010: // ASC_SOCKET_EVENT_TYPE_ON_DISCONNECT
|
||||
{
|
||||
this.CoAuthoringApi._CoAuthoringApi.socketio.onMessage("disconnect", _params || "");
|
||||
break;
|
||||
}
|
||||
|
||||
case 11020: // ASC_SOCKET_EVENT_TYPE_TRY_RECONNECT
|
||||
{
|
||||
this.CoAuthoringApi._CoAuthoringApi._reconnect();
|
||||
// NOT USED
|
||||
break;
|
||||
}
|
||||
case 21000: // ASC_COAUTH_EVENT_TYPE_INSERT_URL_IMAGE
|
||||
|
||||
Reference in New Issue
Block a user