From 0e622c9d5b498597d77c553b8e7c508be68b9ca1 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. --- .../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 77cb15df5df..36cd984acf0 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); + } }); }