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

Arbitrary click-to-copy links #1222

Open
rachaelsalisbury opened this issue Apr 14, 2023 · 1 comment
Open

Arbitrary click-to-copy links #1222

rachaelsalisbury opened this issue Apr 14, 2023 · 1 comment
Labels
enhancement status: needs discussion Issues that need more discussion before they can be properly triaged.

Comments

@rachaelsalisbury
Copy link

Is your feature request related to a problem? Please describe.
I've just implemented the new copy code button on a private project documentation site and am loving the copy functionality. I wonder if it would be possible to extend the logic to copying other things to the clipboard? ie copying an email address to a clipboard, or even if someone didn't need to see the "code" copied. For example, my use case is sharing a Google App Scripts library ID—it's totally fine to have that ID in a code block with a copy code button, but no one really needs to see that ID before copying it.

Describe the solution you'd like
I am not a coder at all, so apologies for any "language barriers" here. Instead of a link button that would be formatted like:

[Click to open google](https://www.google.com/){: .btn}

something as easily customizable where clicking copies a stable string/code. I know this code wouldn't actually work since it's link formatting, but something as easy as:

[Click to copy](text to copy to clipboard){: .btn}
@mattxwang
Copy link
Member

Hi @rachaelsalisbury,

Thank you for submitting an issue! Hm, this is certainly an interesting idea. From my perspective, the biggest difference would be the styling - I'd imagine that you'd want this to look more like an inline link, rather than the actual copy code button? With that in mind, I think we'd want to add a new CSS class that just makes a link "copyable", and allow users to combine it with other CSS classes to style the button itself. What do you think?

(happy to further explore this and push it upstream)

@mattxwang mattxwang added the status: needs discussion Issues that need more discussion before they can be properly triaged. label Apr 20, 2023
@mattxwang mattxwang changed the title Customizable copy button Arbitrary click-to-copy links Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement status: needs discussion Issues that need more discussion before they can be properly triaged.
Projects
None yet
Development

No branches or pull requests

2 participants