diff --git a/www/common/onlyoffice/history.js b/www/common/onlyoffice/history.js index 04429e146..e2b14fea9 100644 --- a/www/common/onlyoffice/history.js +++ b/www/common/onlyoffice/history.js @@ -38,9 +38,7 @@ define([ var hashes = config.onlyoffice.hashes; var id; - var sortedCp = Object.keys(hashes).map(Number).sort(function (a, b) { - return hashes[a].index - hashes[b].index; - }); + var sortedCp = Object.keys(hashes).map(Number); var getId = function () { var cps = sortedCp.length; @@ -71,7 +69,7 @@ define([ return version + '.0'; } - if (typeof(position) === "undefined") { + if (typeof(position) === "undefined" || position === -1) { position = ooMessages[id]?.length || 0; } else if (position === ooMessages[id]?.length && hashes[version + 1]) { position = 0; diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 2871fb8ab..f2b4f5509 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -593,11 +593,9 @@ define([ blob.name = title || (metadataMgr.getMetadataLazy().title || file.doc) + '.' + file.type; var data = { hash: (APP.history || APP.template) ? ooChannel.historyLastHash : ooChannel.lastHash, - index: APP.revert ? ooChannel.currentIndex : ooChannel.cpIndex + index: (APP.history || APP.template) ? ooChannel.currentIndex : ooChannel.cpIndex }; - if (APP.revert) { - APP.revert = false; - } + fixSheets(); if (!isLockedModal.modal) { @@ -3128,11 +3126,10 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null if (!privateData.ooVersionHash) { (function () { /* add a history button */ - var commit = function (revert) { + var commit = function () { // Wait for the checkpoint to be uploaded before leaving history mode // (race condition). We use "stopHistory" to remove the history // flag only when the checkpoint is ready. - APP.revert = revert ? true : false; APP.stopHistory = true; makeCheckpoint(true); };