]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): Allow Ctrl/Command click on file entries to open in a new tab
authorJulius Härtl <jus@bitgrid.net>
Fri, 22 Dec 2023 13:05:22 +0000 (14:05 +0100)
committerJohn Molakvoæ <skjnldsv@users.noreply.github.com>
Thu, 28 Dec 2023 07:34:46 +0000 (08:34 +0100)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
apps/files/src/components/FileEntry.vue
apps/files/src/components/FileEntryGrid.vue

index b89c5dcb3f437532501f5bafefd8abfb8a6c9e42..3ed8b0a5d4b2dbdfe2e1d6c6ec33c69d1b5c5361 100644 (file)
@@ -105,6 +105,7 @@ import { showError } from '@nextcloud/dialogs'
 import { translate as t } from '@nextcloud/l10n'
 import { vOnClickOutside } from '@vueuse/components'
 import moment from '@nextcloud/moment'
+import { generateUrl } from '@nextcloud/router'
 import Vue, { defineComponent } from 'vue'
 
 import { action as sidebarAction } from '../actions/sidebarAction.ts'
@@ -398,8 +399,14 @@ export default defineComponent({
                        event.stopPropagation()
                },
 
-               execDefaultAction(...args) {
-                       this.$refs.actions.execDefaultAction(...args)
+               execDefaultAction(event) {
+                       event.preventDefault()
+                       if (event.ctrlKey || event.metaKey) {
+                               window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
+                               return false
+                       }
+
+                       this.$refs.actions.execDefaultAction(event)
                },
 
                openDetailsIfAvailable(event) {
index def818eea2f3451ec72e8b197455b8396a6d7cf2..682c5fbbc236c12738a8579fcf45c8d6488653bd 100644 (file)
@@ -80,6 +80,7 @@ import { FileType, Permission, Folder, File as NcFile, NodeStatus, Node, View }
 import { getUploader } from '@nextcloud/upload'
 import { showError } from '@nextcloud/dialogs'
 import { translate as t } from '@nextcloud/l10n'
+import { generateUrl } from '@nextcloud/router'
 import { vOnClickOutside } from '@vueuse/components'
 import Vue from 'vue'
 
@@ -281,8 +282,14 @@ export default Vue.extend({
                        event.stopPropagation()
                },
 
-               execDefaultAction(...args) {
-                       this.$refs.actions.execDefaultAction(...args)
+               execDefaultAction(event) {
+                       event.preventDefault()
+                       if (event.ctrlKey || event.metaKey) {
+                               window.open(generateUrl('/f/{fileId}', { fileId: this.fileid }))
+                               return false
+                       }
+
+                       this.$refs.actions.execDefaultAction(event)
                },
 
                openDetailsIfAvailable(event) {