Commit 59a89882 authored by Alexander.Trofimov's avatar Alexander.Trofimov

check DocumentLoadComplete on autoSave

parent 7eb00f47
...@@ -2960,42 +2960,44 @@ var editor; ...@@ -2960,42 +2960,44 @@ var editor;
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
////////////////////////////AutoSave api///////////////////////////////// ////////////////////////////AutoSave api/////////////////////////////////
///////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////
spreadsheet_api.prototype._autoSave = function() { spreadsheet_api.prototype._autoSave = function () {
if ((!this.canUnlockDocument && 0 === this.autoSaveGap && (!this.collaborativeEditing.getFast() || !this.collaborativeEditing.getCollaborativeEditing())) if (!this.DocumentLoadComplete || (!this.canUnlockDocument && 0 === this.autoSaveGap &&
|| this.asc_getCellEditMode() || this.asc_getIsTrackShape() || this.isOpenedChartFrame || (!this.collaborativeEditing.getFast() || !this.collaborativeEditing.getCollaborativeEditing())) ||
!History.IsEndTransaction() || !this.canSave) { this.asc_getCellEditMode() || this.asc_getIsTrackShape() || this.isOpenedChartFrame ||
return; !History.IsEndTransaction() || !this.canSave) {
} return;
}
if (this.canUnlockDocument) {
this.asc_Save(true);
return;
}
if (!History.Have_Changes(true) && !(this.collaborativeEditing.getCollaborativeEditing() && 0 !== this.collaborativeEditing.getOwnLocksLength())) { if (this.canUnlockDocument) {
if (this.collaborativeEditing.getFast() && this.collaborativeEditing.haveOtherChanges()) { this.asc_Save(true);
AscCommon.CollaborativeEditing.Clear_CollaborativeMarks(); return;
}
// Принимаем чужие изменения if (!History.Have_Changes(true) && !(this.collaborativeEditing.getCollaborativeEditing() &&
this.collaborativeEditing.applyChanges(); 0 !== this.collaborativeEditing.getOwnLocksLength())) {
// Пересылаем свои изменения (просто стираем чужие lock-и, т.к. своих изменений нет) if (this.collaborativeEditing.getFast() && this.collaborativeEditing.haveOtherChanges()) {
this.collaborativeEditing.sendChanges(); AscCommon.CollaborativeEditing.Clear_CollaborativeMarks();
// Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно заблокировать toolbar
this.wb._onWSSelectionChanged(); // Принимаем чужие изменения
} this.collaborativeEditing.applyChanges();
return; // Пересылаем свои изменения (просто стираем чужие lock-и, т.к. своих изменений нет)
} this.collaborativeEditing.sendChanges();
if (null === this.lastSaveTime) { // Шлем update для toolbar-а, т.к. когда select в lock ячейке нужно заблокировать toolbar
this.lastSaveTime = new Date(); this.wb._onWSSelectionChanged();
return; }
} return;
var saveGap = this.collaborativeEditing.getFast() ? this.autoSaveGapRealTime : }
(this.collaborativeEditing.getCollaborativeEditing() ? this.autoSaveGapSlow : this.autoSaveGapFast); if (null === this.lastSaveTime) {
var gap = new Date() - this.lastSaveTime - saveGap; this.lastSaveTime = new Date();
if (0 <= gap) { return;
this.asc_Save(true); }
} var saveGap = this.collaborativeEditing.getFast() ? this.autoSaveGapRealTime :
}; (this.collaborativeEditing.getCollaborativeEditing() ? this.autoSaveGapSlow : this.autoSaveGapFast);
var gap = new Date() - this.lastSaveTime - saveGap;
if (0 <= gap) {
this.asc_Save(true);
}
};
spreadsheet_api.prototype._onUpdateDocumentCanSave = function() { spreadsheet_api.prototype._onUpdateDocumentCanSave = function() {
// Можно модифицировать это условие на более быстрое (менять самим состояние в аргументах, а не запрашивать каждый раз) // Можно модифицировать это условие на более быстрое (менять самим состояние в аргументах, а не запрашивать каждый раз)
......
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