Skip to content

Commit 788327f

Browse files
committed
Attachment List: Fixed broken ctrl-click functionality
Fixes #4782
1 parent a4fd825 commit 788327f

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

resources/js/components/attachments-list.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ export class AttachmentsList extends Component {
99

1010
setup() {
1111
this.container = this.$el;
12+
this.fileLinks = this.$manyRefs.linkTypeFile;
13+
1214
this.setupListeners();
1315
}
1416

@@ -27,8 +29,7 @@ export class AttachmentsList extends Component {
2729
}
2830

2931
addOpenQueryToLinks() {
30-
const links = this.container.querySelectorAll('a.attachment-file');
31-
for (const link of links) {
32+
for (const link of this.fileLinks) {
3233
if (link.href.split('?')[1] !== 'open=true') {
3334
link.href += '?open=true';
3435
link.setAttribute('target', '_blank');
@@ -37,8 +38,7 @@ export class AttachmentsList extends Component {
3738
}
3839

3940
removeOpenQueryFromLinks() {
40-
const links = this.container.querySelectorAll('a.attachment-file');
41-
for (const link of links) {
41+
for (const link of this.fileLinks) {
4242
link.href = link.href.split('?')[0];
4343
link.removeAttribute('target');
4444
}

resources/views/attachments/list.blade.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
@foreach($attachments as $attachment)
33
<div class="attachment icon-list">
44
<div class="split-icon-list-item attachment-{{ $attachment->external ? 'link' : 'file' }}">
5-
<a href="{{ $attachment->getUrl() }}" @if($attachment->external) target="_blank" @endif>
5+
<a href="{{ $attachment->getUrl() }}"
6+
refs="attachments-list@link-type-{{ $attachment->external ? 'link' : 'file' }}"
7+
@if($attachment->external) target="_blank" @endif>
68
<div class="icon">@icon($attachment->external ? 'export' : 'file')</div>
79
<div class="label">{{ $attachment->name }}</div>
810
</a>

0 commit comments

Comments
 (0)