From: Alexander Ebert Date: Wed, 9 Oct 2024 11:00:37 +0000 (+0200) Subject: Add a link to view uploaded non-image attachments X-Git-Tag: 6.1.0_RC_1~6 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=fa203fe5c427f28a7a068be09c50f3a69103b119;p=GitHub%2FWoltLab%2FWCF.git Add a link to view uploaded non-image attachments Closes #6011 --- diff --git a/ts/WoltLabSuite/Core/Component/Attachment/Entry.ts b/ts/WoltLabSuite/Core/Component/Attachment/Entry.ts index 494310421f..144caf8078 100644 --- a/ts/WoltLabSuite/Core/Component/Attachment/Entry.ts +++ b/ts/WoltLabSuite/Core/Component/Attachment/Entry.ts @@ -75,6 +75,17 @@ function fileInitializationCompleted(element: HTMLElement, file: WoltlabCoreFile file.isImage() && file.link ? file.link : "", editor, ); + + if (file.link !== undefined && file.filename !== undefined) { + const link = document.createElement("a"); + link.target = "_blank"; + link.href = file.link; + link.textContent = file.filename; + + const filename = element.querySelector(".fileList__item__filename")!; + filename.innerHTML = ""; + filename.append(link); + } } const dropdownMenu = document.createElement("ul"); diff --git a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Attachment/Entry.js b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Attachment/Entry.js index 0dae49ed02..d5bfeb4d6e 100644 --- a/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Attachment/Entry.js +++ b/wcfsetup/install/files/js/WoltLabSuite/Core/Component/Attachment/Entry.js @@ -54,6 +54,15 @@ define(["require", "exports", "tslib", "WoltLabSuite/Core/Ui/Dropdown/Simple", " } else { insertButton = getInsertButton(data.attachmentID, file.isImage() && file.link ? file.link : "", editor); + if (file.link !== undefined && file.filename !== undefined) { + const link = document.createElement("a"); + link.target = "_blank"; + link.href = file.link; + link.textContent = file.filename; + const filename = element.querySelector(".fileList__item__filename"); + filename.innerHTML = ""; + filename.append(link); + } } const dropdownMenu = document.createElement("ul"); dropdownMenu.classList.add("dropdownMenu");