From e548ac2c713652e8617a6c424a140f4268e59cc8 Mon Sep 17 00:00:00 2001 From: Anwar khanfir <93767376+akhanfir@users.noreply.github.com> Date: Wed, 13 Nov 2024 09:12:47 +0100 Subject: [PATCH] fix: Edit button displayed twice in a shared file preview mode - EXO-74839. (#2427) Before this change, when open link of shared file in a new tab, two edit buttons are displayed in the opened preview page. To resolve this problem, make a condition on the edit button insertion to ensure that it is inserted only once. After this change, only one edit button is displayed and no reload page. (cherry picked from commit 0e622c9d5b498597d77c553b8e7c508be68b9ca1) --- .../src/main/webapp/javascript/eXo/ecm/document-preview.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/resources-wcm/src/main/webapp/javascript/eXo/ecm/document-preview.js b/apps/resources-wcm/src/main/webapp/javascript/eXo/ecm/document-preview.js index 6f8f6d0f366..5940762efdf 100644 --- a/apps/resources-wcm/src/main/webapp/javascript/eXo/ecm/document-preview.js +++ b/apps/resources-wcm/src/main/webapp/javascript/eXo/ecm/document-preview.js @@ -637,7 +637,9 @@ if(!this.isDownloadStatusActivated && !documentPreview.defaultSettings.doc.isCloudDrive) { var editorButtonsLoader = editorbuttons.initPreviewButtons(this.settings.doc.id, this.settings.doc.workspace, 'dropup'); editorButtonsLoader.done(function ($buttonsContainer) { - $(".previewBtn").append($buttonsContainer); + if ($(".previewBtn").find('.editorButtonContainer').length === 0){ + $(".previewBtn").append($buttonsContainer); + } }); }