Skip to content

Conversation

@paoloredis
Copy link
Collaborator

@paoloredis paoloredis commented May 12, 2025

@andy-stark-redis
Copy link
Contributor

@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.

@paoloredis
Copy link
Collaborator Author

To me, it seems more natural that it should just copy the text of the snippet whose button you click.

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 POST "https://[host]/v1/fixed/subscriptions" line?

@andy-stark-redis
Copy link
Contributor

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 POST "https://[host]/v1/fixed/subscriptions" line?

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.

@paoloredis
Copy link
Collaborator Author

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)

Copy link
Contributor

@cmilesb cmilesb left a 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!

@paoloredis paoloredis merged commit bffa642 into main May 19, 2025
4 checks passed
@paoloredis paoloredis deleted the DOC-5217 branch May 19, 2025 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants