From cf003140b7c0ff6059bd3081b0eb873e02a4df93 Mon Sep 17 00:00:00 2001 From: yflory Date: Tue, 25 Feb 2025 16:28:40 +0100 Subject: [PATCH] Tell other members in integration session when you save --- www/common/onlyoffice/inner.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/www/common/onlyoffice/inner.js b/www/common/onlyoffice/inner.js index 69a5130bc..219798d7c 100644 --- a/www/common/onlyoffice/inner.js +++ b/www/common/onlyoffice/inner.js @@ -1482,6 +1482,9 @@ define([ console.error(obj.error); return void UI.warn(Messages.error); } + content.integrationSave = `${myUniqueOOId}-${+new Date()}`; + APP.integrationSaved = content.integrationSave; + APP.onLocal(); UI.log(Messages.saved); }); } @@ -3273,6 +3276,9 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null }); } else { APP.integrationSave = integrationSave; + APP.integrationSetSaved = () => { + hasUnsavedChanges = false; + }; evIntegrationSave.reg(function () { hasUnsavedChanges = true; }); @@ -3438,6 +3444,7 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null var wasMigrating = content.migration; var myLocks = getUserLock(getId(), true); + var integrationSave = content.integrationSave; content = json.content; @@ -3448,6 +3455,15 @@ Uncaught TypeError: Cannot read property 'calculatedType' of null checkCheckpoint(); } + // Integration: mark the current content as saved + // if manually saved by someone else + if (content.integrationSave !== APP.integrationSaved) { + APP.integrationSaved = content.integrationSave; + if (APP.integrationSetSaved) { + APP.integrationSetSaved(); + } + } + var editor = getEditor(); if (content.hashes) { var latest = getLastCp(true);