Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(files): Allow Ctrl/Command click on file entries to open in a new tab #42457

Merged
merged 2 commits into from
Dec 27, 2023

Conversation

juliusknorr
Copy link
Member

@juliusknorr juliusknorr commented Dec 22, 2023

Bring back opening files in a new tab by Ctrl-clicking on the file list entry. metaKey is needed for macOS support.

@juliusknorr juliusknorr requested review from skjnldsv, susnux, a team and nfebe and removed request for a team December 22, 2023 13:07
@juliusknorr juliusknorr added bug 3. to review Waiting for reviews labels Dec 22, 2023
@juliusknorr juliusknorr added this to the Nextcloud 29 milestone Dec 22, 2023
@juliusknorr
Copy link
Member Author

/backport to stable28

@skjnldsv skjnldsv added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Dec 27, 2023
@skjnldsv skjnldsv force-pushed the bugfix/noid/ctrl-click branch from 4cb0c9e to 89f7f93 Compare December 27, 2023 08:30
@skjnldsv
Copy link
Member

/compile /

@juliusknorr juliusknorr force-pushed the bugfix/noid/ctrl-click branch from 89f7f93 to 2c7f632 Compare December 27, 2023 09:15
@juliusknorr
Copy link
Member Author

/compile

Signed-off-by: nextcloud-command <[email protected]>
@skjnldsv
Copy link
Member

skjnldsv commented Dec 27, 2023

The bot is soooo weird @juliushaertl
image

@juliusknorr
Copy link
Member Author

juliusknorr commented Dec 27, 2023

I restarted the action manually as it didn't seem to be working smoothly on self-hosted runners

@juliusknorr
Copy link
Member Author

@skjnldsv
Copy link
Member

Oooh, it fails if init ran on a different runner type than process

@skjnldsv skjnldsv merged commit 1fbfc4f into master Dec 27, 2023
42 checks passed
@skjnldsv skjnldsv deleted the bugfix/noid/ctrl-click branch December 27, 2023 09:57
@backportbot-nextcloud
Copy link

The backport to stable28 failed. Please do this backport manually.

# Switch to the target branch and update it
git checkout stable28
git pull origin stable28

# Create the new backport branch
git checkout -b fix/foo-stable28

# Cherry pick the change from the commit sha1 of the change against the default branch
# This might cause conflicts. Resolve them.
git cherry-pick abc123

# Push the cherry pick commit to the remote repository and open a pull request
git push origin fix/foo-stable28

Error: Unknown error

More info at https://docs.nextcloud.com/server/latest/developer_manual/getting_started/development_process.html#manual-backport

@juliusknorr
Copy link
Member Author

/backport 2c7f632 to stable28

@ShGKme
Copy link
Contributor

ShGKme commented Jan 25, 2024

This solution overrides browser default behavior. While it allows to open link on new tab, the link is still invalid:

  • Middle click is invalid
  • Context menu is invalid
  • title and attributes are invalid

For example, for a folder it says that it is a link to download a file via /remote.php while actually click opens a folder.

@ShGKme
Copy link
Contributor

ShGKme commented Jan 25, 2024

This line doesn't work, we cannot take data from another child through parent on initial render. There is no another child on this moment.

const enabledDefaultActions = this.$parent?.$refs?.actions?.enabledDefaultActions

And anyway I don't think it is a good approach to transfer data by manually going through nodes...

@juliusknorr
Copy link
Member Author

I'm not sure what URL I would expect...

  • Internal file link (/f/12345) would work for middle click and context menu open in new tab/window, but would not work when using the browsers "Save link as"
  • WebDAV URL does not work for open in a new tab then

@ShGKme
Copy link
Contributor

ShGKme commented Jan 25, 2024

Link should be the same as what it opens. If a link opens /foo/bar, then it should have href /foo/bar.

Here it also makes the link download link and the title says "Download".

The source of the issue is that this line, that was supposed to find the default action, fails on initial rendering.

There is the default action for a folder (open it), but this line on component creation doesn't work, because it tries to get data from another not mounted component, not from the state.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4. to release Ready to be released and/or waiting for tests to finish bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: Cannot open documents/files in new tabs anymore (using Ctrl+Click) since NC 28
5 participants