diff --git a/install-onlyoffice.sh b/install-onlyoffice.sh index 69d935150..034b01588 100755 --- a/install-onlyoffice.sh +++ b/install-onlyoffice.sh @@ -98,8 +98,8 @@ main() { rm -rf "$OO_DIR/v8/web-apps/apps/spreadsheeteditor/main/resources/help" rm -rf "$OO_DIR/v8/web-apps/apps/common/main/resources/help/" ;; - v9) install_version v9 v9.2.0.119+5 1f1184fb04cf72a7eb2a49a9740074b5419486c79e1fd713e1f8c09b8594a826050ae941fed6ac6a96807ba73cc751d7c807bd7e6b73de9e4f8e74cd5ed04cfa ;; - x2t) install_x2t v7.3+1 ab0c05b0e4c81071acea83f0c6a8e75f5870c360ec4abc4af09105dd9b52264af9711ec0b7020e87095193ac9b6e20305e446f2321a541f743626a598e5318c1 ;; + v9) install_version v9 v9.3.2+0 9f4fe5e865b28e74779d1f3c8ca450421a8491287db58f258a37b859b184941f89015af0c7c8f7ec7f6dc88e46071c5183b7ac6106b0f374a0ea28218833fec7 ;; + x2t) install_x2t v9.3.0+0 e82fbf21fcdcff2cbaca5b9a49c3a3d6bc5f5f02ba9b704a7384ceb91e17e979bf7659aaf59f677edf319fde91dd847b419e018f58f38eb1df6ab433a6cd207c ;; *) echo "Unknown version: $version" exit 1 diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 3fdb0cb99..21e7d0cd4 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -96,7 +96,7 @@ define([ hashes: {}, ids: {}, mediasSources: {}, - version: privateData.ooForceVersion ? Number(privateData.ooForceVersion) : OOCurrentVersion.currentVersionNumber + version: privateData.ooForceVersion ? Number(privateData.ooForceVersion) : OOCurrentVersion.currentVersionNumber, }; content.originalVersion = content.version; var oldHashes = {}; @@ -2286,6 +2286,11 @@ define([ }]; common.checkTrimHistory(channels); } + + content.debug = content.debug ?? {}; + content.debug.idCollision = content.debug.idCollision ?? false; + APP.onLocal(); + console.log("OO ready"); }; @@ -2708,12 +2713,25 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null makeChannel(); return; } + + const onCorruptionWarning = Util.once((id) => { + console.log('id collision in document', id); + if (content?.debug?.idCollision !== undefined // No feedback for old documents + && content?.debug?.idCollision === false) { // Send feedback only once + Feedback.send(`channel=${content.channel}&OFFICE_DOCUMENT_ID_COLLISION`, true); + content.debug = content.debug ?? {}; + content.debug.idCollision = true; + APP.onLocal(); + } + }); + APP.docEditor.connectMockServer({ onMessage: fromOOHandler, getParticipants: getParticipants, onAuth: onAuth, getImageURL: getImageURL, getInitialChanges: getInitialChanges, + onCorruptionWarning: onCorruptionWarning, }); }; @@ -3081,7 +3099,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null pinImages(); }; - const loadCp = async function (cp, keepQueue) { + const loadCheckpoint = async function (cp, keepQueue) { if (!isLockedModal.modal) { isLockedModal.modal = UI.openCustomModal(isLockedModal.content); } @@ -3099,6 +3117,12 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }; var loadTemplate = function (href, password, parsed) { + var loadHistoryCp = function (cp, keepQueue) { + APP.history = true; + APP.stopHistory = false; + loadCheckpoint(cp, keepQueue); + }; + APP.history = true; APP.template = true; var editor = getEditor(); @@ -3124,7 +3148,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null nextCp: undefined }).then(messages => { if (!Array.isArray(messages)) { return void console.error('Not an array!'); } - ooChannel.queue = messages.map(function (obj) { + ooChannel.queue = messages.map(function(obj) { return { hash: obj.serverHash, msg: JSON.parse(obj.msg) @@ -3132,7 +3156,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }); ooChannel.historyLastHash = ooChannel.lastHash; ooChannel.currentIndex = ooChannel.cpIndex; - loadCp(lastCp, true); + loadCheckpoint(lastCp, true); }).catch(err => { console.error(err); }); @@ -3308,7 +3332,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }; var onCheckpoint = function (cp) { // We want to load a checkpoint: - loadCp(cp); + loadCheckpoint(cp); }; var onPatchBack = function (cp, msgs) { if (msgs) { @@ -3325,10 +3349,10 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }); ooChannel.queue = msgsFormatted; setTimeout(function () { - loadCp(cp, true); + loadCheckpoint(cp, true); }, 200); } else { - loadCp(cp); + loadCheckpoint(cp); } }; var setHistoryMode = function (bool) { @@ -3348,7 +3372,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null rtChannel.getHistory(function () { var lastCp = getLastCp(); - loadCp(lastCp, true); + loadCheckpoint(lastCp, true); }); }; @@ -3404,6 +3428,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null var histConfig = { onPatch: onPatch, onPatchBack: onPatchBack, + docType: docType, + loadCp: loadCheckpoint, + loadHistoryCp: loadHistoryCp, onCheckpoint: onCheckpoint, onRevert: commit, setHistory: setHistoryMode,