Skip to content

Commit 89f7f93

Browse files
juliusknorrskjnldsv
authored andcommitted
fix(files): Allow Ctrl/Command click on file entries to open in a new tab
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent 65eab30 commit 89f7f93

File tree

2 files changed

+18
-4
lines changed

2 files changed

+18
-4
lines changed

apps/files/src/components/FileEntry.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ import { showError } from '@nextcloud/dialogs'
105105
import { translate as t } from '@nextcloud/l10n'
106106
import { vOnClickOutside } from '@vueuse/components'
107107
import moment from '@nextcloud/moment'
108+
import { generateUrl } from '@nextcloud/router'
108109
import Vue, { defineComponent } from 'vue'
109110
110111
import { action as sidebarAction } from '../actions/sidebarAction.ts'
@@ -398,8 +399,14 @@ export default defineComponent({
398399
event.stopPropagation()
399400
},
400401
401-
execDefaultAction(...args) {
402-
this.$refs.actions.execDefaultAction(...args)
402+
execDefaultAction(event) {
403+
event.preventDefault()
404+
if (event.ctrlKey || event.metaKey) {
405+
window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
406+
return false
407+
}
408+
409+
this.$refs.actions.execDefaultAction(event)
403410
},
404411
405412
openDetailsIfAvailable(event) {

apps/files/src/components/FileEntryGrid.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import { FileType, Permission, Folder, File as NcFile, NodeStatus, Node, View }
8080
import { getUploader } from '@nextcloud/upload'
8181
import { showError } from '@nextcloud/dialogs'
8282
import { translate as t } from '@nextcloud/l10n'
83+
import { generateUrl } from '@nextcloud/router'
8384
import { vOnClickOutside } from '@vueuse/components'
8485
import Vue from 'vue'
8586
@@ -281,8 +282,14 @@ export default Vue.extend({
281282
event.stopPropagation()
282283
},
283284
284-
execDefaultAction(...args) {
285-
this.$refs.actions.execDefaultAction(...args)
285+
execDefaultAction(event) {
286+
event.preventDefault()
287+
if (event.ctrlKey || event.metaKey) {
288+
window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
289+
return false
290+
}
291+
292+
this.$refs.actions.execDefaultAction(event)
286293
},
287294
288295
openDetailsIfAvailable(event) {

0 commit comments

Comments
 (0)