Skip to content

Commit

Permalink
fix(files): also trigger new tab on file name middle click
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Signed-off-by: nextcloud-command <nextcloud-command@users.noreply.github.com>
  • Loading branch information
skjnldsv authored and nextcloud-command committed Jun 12, 2024
1 parent 4c32ab7 commit a094ac0
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
4 changes: 3 additions & 1 deletion apps/files/src/components/FileEntry.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<FileEntryPreview ref="preview"
:source="source"
:dragover="dragover"
@auxclick.native="execDefaultAction"
@click.native="execDefaultAction" />

<FileEntryName ref="name"
Expand All @@ -38,7 +39,8 @@
:files-list-width="filesListWidth"
:nodes="nodes"
:source="source"
@click="execDefaultAction" />
@auxclick.native="execDefaultAction"
@click.native="execDefaultAction" />
</td>

<!-- Actions -->
Expand Down
3 changes: 1 addition & 2 deletions apps/files/src/components/FileEntry/FileEntryName.vue
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
:aria-hidden="isRenaming"
class="files-list__row-name-link"
data-cy-files-list-row-name-link
v-bind="linkTo.params"
@click="$emit('click', $event)">
v-bind="linkTo.params">
<!-- File name -->
<span class="files-list__row-name-text">
<!-- Keep the displayName stuck to the extension to avoid whitespace rendering issues-->
Expand Down
4 changes: 3 additions & 1 deletion apps/files/src/components/FileEntryGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
:dragover="dragover"
:grid-mode="true"
:source="source"
@auxclick.native="execDefaultAction"
@click.native="execDefaultAction" />

<FileEntryName ref="name"
Expand All @@ -41,7 +42,8 @@
:grid-mode="true"
:nodes="nodes"
:source="source"
@click="execDefaultAction" />
@auxclick.native="execDefaultAction"
@click.native="execDefaultAction" />
</td>

<!-- Actions -->
Expand Down
3 changes: 2 additions & 1 deletion apps/files/src/components/FileEntryMixin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,8 @@ export default defineComponent({
},

execDefaultAction(event) {
if (event.ctrlKey || event.metaKey) {
// if ctrl+click or middle mouse button, open in new tab
if (event.ctrlKey || event.metaKey || event.button === 1) {
event.preventDefault()
window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
return false
Expand Down
6 changes: 3 additions & 3 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.

0 comments on commit a094ac0

Please sign in to comment.