Commit 2cdd3350 authored by konovalovsergey's avatar konovalovsergey

force save initiator notification

parent 94925eaa
......@@ -578,9 +578,9 @@
t.isOnLoadLicense = true;
t._onEndPermissions();
};
this.CoAuthoringApi.onWarning = function(e)
this.CoAuthoringApi.onWarning = function(code)
{
t.sendEvent('asc_onError', c_oAscError.ID.Warning, c_oAscError.Level.NoCritical);
t.sendEvent('asc_onError', code || c_oAscError.ID.Warning, c_oAscError.Level.NoCritical);
};
this.CoAuthoringApi.onMeta = function(data)
{
......
......@@ -39,6 +39,7 @@
var ConnectionState = AscCommon.ConnectionState;
var c_oEditorId = AscCommon.c_oEditorId;
var c_oCloseCode = AscCommon.c_oCloseCode;
var c_oAscServerCommandErrors = AscCommon.c_oAscServerCommandErrors;
// Класс надстройка, для online и offline работы
function CDocsCoApi(options) {
......@@ -539,6 +540,7 @@
this.jwtTimeOutId = null;
this._id = null;
this._sessionTimeConnect = null;
this._lastForceSaveId = null;
this._indexUser = -1;
// Если пользователей больше 1, то совместно редактируем
this.isCoAuthoring = false;
......@@ -828,7 +830,7 @@
};
DocsCoApi.prototype.forceSave = function() {
this._send({'type': 'forcesave'});
this._send({'type': 'forcesave', 'saveid': new Date().getTime()});
};
DocsCoApi.prototype.openDocument = function(data) {
......@@ -929,6 +931,14 @@
}
};
DocsCoApi.prototype._onForceSave = function(data) {
if (data['code'] === c_oAscServerCommandErrors.NoError) {
this._lastForceSaveId = data['saveid'];
} else if (data['code'] !== c_oAscServerCommandErrors.NotModified) {
this.onWarning(c_oAscError.ID.Unknown);
}
};
DocsCoApi.prototype._onGetLock = function(data) {
if (data["locks"]) {
for (var key in data["locks"]) {
......@@ -1229,7 +1239,7 @@
};
DocsCoApi.prototype._onWarning = function(data) {
this.onWarning(data ? data['description'] : '');
this.onWarning(c_oAscError.ID.Warning);
};
DocsCoApi.prototype._onLicense = function(data) {
......@@ -1469,6 +1479,9 @@
case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]);
break;
case 'forcesave' :
t._onForceSave(dataObject["messages"]);
break;
}
};
sockjs.onclose = function(evt) {
......
This diff is collapsed.
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