diff options
author | skjnldsv <skjnldsv@protonmail.com> | 2025-04-25 15:02:14 +0200 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2025-05-07 10:29:36 +0200 |
commit | c446274bf05171d537a4129ef36891f32a9791b5 (patch) | |
tree | 8768e55ce38a578cfe25503381e7cacff1f24b52 | |
parent | 7880a5c25e9cf448edfe8208fefb9ffb49ab62e4 (diff) | |
download | nextcloud-server-c446274bf05171d537a4129ef36891f32a9791b5.tar.gz nextcloud-server-c446274bf05171d537a4129ef36891f32a9791b5.zip |
fix(files): middle click & ctrl new tab
Signed-off-by: skjnldsv <skjnldsv@protonmail.com>
-rw-r--r-- | apps/files/src/components/FileEntryMixin.ts | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/apps/files/src/components/FileEntryMixin.ts b/apps/files/src/components/FileEntryMixin.ts index 589073e7b9a..735490c45b3 100644 --- a/apps/files/src/components/FileEntryMixin.ts +++ b/apps/files/src/components/FileEntryMixin.ts @@ -356,7 +356,7 @@ export default defineComponent({ // if ctrl+click / cmd+click (MacOS uses the meta key) or middle mouse button (button & 4), open in new tab // also if there is no default action use this as a fallback - const metaKeyPressed = event.ctrlKey || event.metaKey || Boolean(event.button & 4) + const metaKeyPressed = event.ctrlKey || event.metaKey || event.button === 1 if (metaKeyPressed || !this.defaultFileAction) { // If no download permission, then we can not allow to download (direct link) the files if (isPublicShare() && !isDownloadable(this.source)) { @@ -368,7 +368,9 @@ export default defineComponent({ : generateUrl('/f/{fileId}', { fileId: this.fileid }) event.preventDefault() event.stopPropagation() - window.open(url, metaKeyPressed ? '_self' : undefined) + + // Open the file in a new tab if the meta key or the middle mouse button is clicked + window.open(url, metaKeyPressed ? '_blank' : '_self') return } |