From 788327fffb044a03ccc490be0bcddd48e3551b01 Mon Sep 17 00:00:00 2001 From: Dan Brown Date: Tue, 23 Jan 2024 15:01:07 +0000 Subject: [PATCH] Attachment List: Fixed broken ctrl-click functionality Fixes #4782 --- resources/js/components/attachments-list.js | 8 ++++---- resources/views/attachments/list.blade.php | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/resources/js/components/attachments-list.js b/resources/js/components/attachments-list.js index 4db09977f..665904f86 100644 --- a/resources/js/components/attachments-list.js +++ b/resources/js/components/attachments-list.js @@ -9,6 +9,8 @@ export class AttachmentsList extends Component { setup() { this.container = this.$el; + this.fileLinks = this.$manyRefs.linkTypeFile; + this.setupListeners(); } @@ -27,8 +29,7 @@ export class AttachmentsList extends Component { } addOpenQueryToLinks() { - const links = this.container.querySelectorAll('a.attachment-file'); - for (const link of links) { + for (const link of this.fileLinks) { if (link.href.split('?')[1] !== 'open=true') { link.href += '?open=true'; link.setAttribute('target', '_blank'); @@ -37,8 +38,7 @@ export class AttachmentsList extends Component { } removeOpenQueryFromLinks() { - const links = this.container.querySelectorAll('a.attachment-file'); - for (const link of links) { + for (const link of this.fileLinks) { link.href = link.href.split('?')[0]; link.removeAttribute('target'); } diff --git a/resources/views/attachments/list.blade.php b/resources/views/attachments/list.blade.php index a6ffb709b..71197cc19 100644 --- a/resources/views/attachments/list.blade.php +++ b/resources/views/attachments/list.blade.php @@ -2,7 +2,9 @@ @foreach($attachments as $attachment)