Commit 8b3bd2d8 authored by Alexander.Trofimov's avatar Alexander.Trofimov Committed by Alexander.Trofimov

Вместе с изменениями приходит точка, с которой затирать изменения.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@56540 954022d7-b5bf-4e40-9824-e11837661b57
parent 57cc7594
...@@ -124,9 +124,9 @@ ...@@ -124,9 +124,9 @@
} }
}; };
CDocsCoApi.prototype.saveChanges = function (arrayChanges) { CDocsCoApi.prototype.saveChanges = function (arrayChanges, deleteIndex) {
if (this._CoAuthoringApi && this._onlineWork) { if (this._CoAuthoringApi && this._onlineWork) {
this._CoAuthoringApi.saveChanges(arrayChanges); this._CoAuthoringApi.saveChanges(arrayChanges, null, deleteIndex);
} }
}; };
...@@ -270,6 +270,8 @@ ...@@ -270,6 +270,8 @@
this.maxCountSaveChanges = 20000; this.maxCountSaveChanges = 20000;
// Текущий индекс для колличества изменений // Текущий индекс для колличества изменений
this.currentIndex = 0; this.currentIndex = 0;
// Индекс, с которого мы начинаем сохранять изменения
this.deleteIndex = 0;
// Массив изменений // Массив изменений
this.arrayChanges = null; this.arrayChanges = null;
...@@ -404,8 +406,9 @@ ...@@ -404,8 +406,9 @@
} }
}; };
DocsCoApi.prototype.saveChanges = function (arrayChanges, currentIndex) { DocsCoApi.prototype.saveChanges = function (arrayChanges, currentIndex, deleteIndex) {
if (undefined === currentIndex) { if (null === currentIndex) {
this.deleteIndex = deleteIndex;
this.currentIndex = 0; this.currentIndex = 0;
this.arrayChanges = arrayChanges; this.arrayChanges = arrayChanges;
} else { } else {
...@@ -414,7 +417,7 @@ ...@@ -414,7 +417,7 @@
var startIndex = this.currentIndex * this.maxCountSaveChanges; var startIndex = this.currentIndex * this.maxCountSaveChanges;
var endIndex = Math.min(this.maxCountSaveChanges * (this.currentIndex + 1), arrayChanges.length); var endIndex = Math.min(this.maxCountSaveChanges * (this.currentIndex + 1), arrayChanges.length);
if (endIndex === arrayChanges.length) { if (endIndex === arrayChanges.length) {
for (var key in this._locks) { for (var key in this._locks) if (this._locks.hasOwnProperty(key)) {
if (2 === this._locks[key].state /*lock is ours*/) if (2 === this._locks[key].state /*lock is ours*/)
delete this._locks[key]; delete this._locks[key];
} }
...@@ -422,7 +425,7 @@ ...@@ -422,7 +425,7 @@
this._send({"type": "savechanges", "changes": JSON.stringify(arrayChanges.slice(startIndex, endIndex)), this._send({"type": "savechanges", "changes": JSON.stringify(arrayChanges.slice(startIndex, endIndex)),
"startSaveChanges": (startIndex === 0), "endSaveChanges": (endIndex === arrayChanges.length), "startSaveChanges": (startIndex === 0), "endSaveChanges": (endIndex === arrayChanges.length),
"isCoAuthoring": this.isCoAuthoring, "isExcel": this._isExcel}); "isCoAuthoring": this.isCoAuthoring, "isExcel": this._isExcel, "deleteIndex": this.deleteIndex});
}; };
DocsCoApi.prototype.getUsers = function () { DocsCoApi.prototype.getUsers = function () {
...@@ -828,8 +831,8 @@ ...@@ -828,8 +831,8 @@
docsCoApi._onAuthParticipantsChanged(data["participants"]); docsCoApi._onAuthParticipantsChanged(data["participants"]);
if (data["indexuser"]) { if (data["indexUser"]) {
docsCoApi._indexuser = data["indexuser"]; docsCoApi._indexuser = data["indexUser"];
docsCoApi._onSetIndexUser (docsCoApi._indexuser); docsCoApi._onSetIndexUser (docsCoApi._indexuser);
} }
......
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