-
Notifications
You must be signed in to change notification settings - Fork 277
Add copy to clipboard for code snippets #1548
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
Conversation
|
@paoloredis Great idea! Just some things for discussion... The copy button appears to copy the whole example file each time. To me, it seems more natural that it should just copy the text of the snippet whose button you click. Ideally, if you have the eye icon enabled to show the whole file, the button should then copy the whole file at once. Also, I think it would be great to extend this feature to the command page snippets, but it's probably even more important there to copy just the isolated snippet text. Just my thoughts - I'd love to hear what you and everyone else thinks about this. Basically a very good feature, though, even as it is. |
What do you mean with this? If we take the first snippet in this page https://redis.io/docs/staging/DOC-5217/operate/rc/api/examples/manage-subscriptions/, what should be copied in your opinion, just the |
Sorry for the misunderstanding - TBH, it didn't occur to me that the copy button would appear on all code snippets (I assumed it was just the tabbed-code examples). What I meant was that for the TCEs specifically, it copies the whole of the source file that backs the snippets for the page (eg, for hashes, if you click the copy button on the example at the top, it also copies all the other examples to the clipboard as well). Seems more natural for these if the button just copies the single snippet, if possible. |
|
I didn't realize the tabbed code examples already had the copy button. So we need to decide whether we keep what we already have there or replace the copy button with the new one (and a new eye button) |
cmilesb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great, thanks for doing this @paoloredis!
Staging link: https://redis.io/docs/staging/DOC-5217/