Commit 78898f9f authored by Alexey.Musinov's avatar Alexey.Musinov

Merge branch 'develop' of https://github.com/ONLYOFFICE/sdkjs into develop

* 'develop' of https://github.com/ONLYOFFICE/sdkjs:
  force save on timeout
  select shape
  mobile color for selection
  delete unused variable
  fix bug 34073
parents 9d1b50cc d5f6213c
......@@ -1349,6 +1349,7 @@ var editor;
if (this.isMobileVersion) {
this.wb.defaults.worksheetView.halfSelection = true;
this.wb.defaults.worksheetView.activeCellBorderColor = new CColor(79, 158, 79);
var _container = document.getElementById(this.HtmlElementName);
if (_container)
_container.style.overflow = "hidden";
......
......@@ -43,7 +43,6 @@
* Import
* -----------------------------------------------------------------------------
*/
var c_oAscBorderStyles = AscCommon.c_oAscBorderStyles;
var c_oAscFormatPainterState = AscCommon.c_oAscFormatPainterState;
var AscBrowser = AscCommon.AscBrowser;
var CColor = AscCommon.CColor;
......
......@@ -11753,12 +11753,13 @@
if(bIsExpandRange)
{
var selectionRange = t.model.selectionRange;
var activeCell = selectionRange.activeCell;
var activeCell = selectionRange.activeCell.clone();
var activeCellRange = new Asc.Range(activeCell.col, activeCell.row, activeCell.col, activeCell.row);
var expandRange = t.model.autoFilters._getAdjacentCellsAF(activeCellRange, true);
//change selection
t.setSelection(expandRange);
selectionRange.activeCell = activeCell;
}
//sort
......
......@@ -1702,6 +1702,7 @@ function DrawingObjects() {
var oShape = oTrack.getShape(false, _this.drawingDocument, null);
oShape.setWorksheet(worksheet.model);
oShape.addToDrawingObjects();
oShape.select(_this.controller, 0);
worksheet.setSelectionShape(true);
_this.controller.startRecalculate();
});
......
......@@ -644,6 +644,13 @@
}
}
};
this.CoAuthoringApi.onForceSave = function(data) {
if (AscCommon.c_oAscForceSaveTypes.Button === data.type) {
t.sendEvent('asc_onForceSaveButton');
} else if (AscCommon.c_oAscForceSaveTypes.Timeout === data.type) {
t.sendEvent('asc_onForceSaveTimeout', data.saved);
}
};
/**
* Event об отсоединении от сервера
* @param {jQuery} e event об отсоединении с причиной
......
......@@ -40,6 +40,7 @@
var c_oEditorId = AscCommon.c_oEditorId;
var c_oCloseCode = AscCommon.c_oCloseCode;
var c_oAscServerCommandErrors = AscCommon.c_oAscServerCommandErrors;
var c_oAscForceSaveTypes = AscCommon.c_oAscForceSaveTypes;
// Класс надстройка, для online и offline работы
function CDocsCoApi(options) {
......@@ -53,6 +54,7 @@
this.onCursor = options.onCursor;
this.onMeta = options.onMeta;
this.onSession = options.onSession;
this.onForceSave = options.onForceSave;
this.onLocksAcquired = options.onLocksAcquired;
this.onLocksReleased = options.onLocksReleased;
this.onLocksReleasedEnd = options.onLocksReleasedEnd; // ToDo переделать на массив release locks
......@@ -93,6 +95,9 @@
};
this._CoAuthoringApi.onSession = function(e) {
t.callback_OnSession(e);
};
this._CoAuthoringApi.onForceSave = function(e) {
t.callback_OnForceSave(e);
};
this._CoAuthoringApi.onLocksAcquired = function(e) {
t.callback_OnLocksAcquired(e);
......@@ -391,6 +396,12 @@
this.onSession(e);
}
};
CDocsCoApi.prototype.callback_OnForceSave = function(e) {
if (this.onForceSave) {
this.onForceSave(e);
}
};
CDocsCoApi.prototype.callback_OnLocksAcquired = function(e) {
if (this.onLocksAcquired) {
......@@ -507,6 +518,7 @@
this.onCursor = options.onCursor;
this.onMeta = options.onMeta;
this.onSession = options.onSession;
this.onForceSave = options.onForceSave;
this.onLocksAcquired = options.onLocksAcquired;
this.onLocksReleased = options.onLocksReleased;
this.onLocksReleasedEnd = options.onLocksReleasedEnd; // ToDo переделать на массив release locks
......@@ -542,7 +554,9 @@
this.jwtTimeOutId = null;
this._id = null;
this._sessionTimeConnect = null;
this._lastForceSaveId = null;
this._allChangesSaved = null;
this._lastForceSaveTime = null;
this._lastForceSaveButtonTime = null;
this._indexUser = -1;
// Если пользователей больше 1, то совместно редактируем
this.isCoAuthoring = false;
......@@ -559,6 +573,7 @@
this.arrayChanges = null;
// Время последнего сохранения (для разрыва соединения)
this.lastOtherSaveTime = -1;
this.lastOwnSaveTime = -1;
// Локальный индекс изменений
this.changesIndex = 0;
// Дополнительная информация для Excel
......@@ -840,7 +855,7 @@
};
DocsCoApi.prototype.forceSave = function() {
this._send({'type': 'forcesave', 'saveid': new Date().getTime()});
this._send({'type': 'forceSaveStart'});
};
DocsCoApi.prototype.openDocument = function(data) {
......@@ -941,13 +956,36 @@
}
};
DocsCoApi.prototype._onForceSave = function(data) {
DocsCoApi.prototype._onForceSaveStart = function(data) {
if (data['code'] === c_oAscServerCommandErrors.NoError) {
this._lastForceSaveId = data['saveid'];
this._lastForceSaveButtonTime = data['time'];
} else if (data['code'] !== c_oAscServerCommandErrors.NotModified) {
this.onWarning(c_oAscError.ID.Unknown);
}
};
DocsCoApi.prototype._onForceSave = function(data) {
if (c_oAscForceSaveTypes.Button === data['type']) {
if (this._lastForceSaveButtonTime == data['time']) {
this.onForceSave({type: c_oAscForceSaveTypes.Button, saved:true});
}
} else if(c_oAscForceSaveTypes.Timeout === data['type']) {
this._lastForceSaveTime = data['time'];
this._checkLastForceSave();
}
};
DocsCoApi.prototype._checkLastForceSave = function(data) {
if (null != this._lastForceSaveTime) {
var newState = false;
if((-1 == this.lastOtherSaveTime || this.lastOtherSaveTime <= this._lastForceSaveTime) &&
(-1 == this.lastOwnSaveTime || this.lastOwnSaveTime <= this._lastForceSaveTime)) {
newState = true;
}
if(newState != this._allChangesSaved){
this._allChangesSaved = newState;
this.onForceSave({type: c_oAscForceSaveTypes.Timeout, saved:this._allChangesSaved});
}
}
};
DocsCoApi.prototype._onGetLock = function(data) {
if (this.check_state() && data["locks"]) {
......@@ -1104,7 +1142,12 @@
if (-1 !== data['index']) {
this.changesIndex = data['index'];
}
if (-1 !== data['time']) {
this.lastOwnSaveTime = data['time'];
this._checkLastForceSave();
}
if (this.onUnSaveLock) {
this.onUnSaveLock();
}
......@@ -1124,6 +1167,7 @@
this.onSaveChanges(JSON.parse(changesOneUser), change['useridoriginal'], bFirstLoad);
}
}
this._checkLastForceSave();
}
}
};
......@@ -1306,6 +1350,7 @@
this._state = ConnectionState.Authorized;
this._id = data['sessionId'];
this._sessionTimeConnect = data['sessionTimeConnect'];
this._lastForceSaveTime = data['lastForceSaveTime'];
this._onAuthParticipantsChanged(data['participants']);
......@@ -1496,7 +1541,10 @@
case 'refreshToken' :
t._onRefreshToken(dataObject["messages"]);
break;
case 'forcesave' :
case 'forceSaveStart' :
t._onForceSaveStart(dataObject["messages"]);
break;
case 'forceSave' :
t._onForceSave(dataObject["messages"]);
break;
}
......
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