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

Ability to hide "Copy Link" and "Save Link As" for file:// protocol #152

Open
oleg-slapdash opened this issue Nov 27, 2021 · 2 comments
Open

Comments

@oleg-slapdash
Copy link

Currently, the package allows copying links that are not really links and just internal files.

It would be awesome if there was a way to disable file:// links from being treated as links.

Alternatively, maybe we can pass a function instead of a callback into showCopyLink so we can fine-tune the behaviour.

@sindresorhus
Copy link
Owner

sindresorhus commented Nov 28, 2021

I think it would make sense to add a top-level option for this. I think it should hide them for file:// by default. You would rarely want to expose file:// URLs.

Same applies to copy image and video address too.

@ibandominguez
Copy link

For anyone facing this issue and reading this.

It might not be the best solution since it targets the whole menu, but the api offers and option function parameter shouldShowMenu that decides wether or not the menu should be shown:

shouldShowMenu: (event, parameters) => {
  return !paremeters.linkURL.includes('file://')
}

In case I didn't want any context on links so it did the trick.

Hope it helps somebody out there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants