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
UI: Allow keyboard shortcut to copy code in preview blocks #15559
Conversation
Nx Cloud ReportCI ran the following commands for commit 2cb3910. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
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.
Hey @melindali255 👋 Thank you for taking the time to improve Storybook!!
I love this! ❤️ It's very clean, and works as expected (this is me pressing CTRL + C a lot)
Is there a use-case where people may want to copy partial code?
In the current version, if I highlight a partial code block, I can copy that text. In your solution, I am only able to copy the full block. I'm eager to hear your thoughts!
If this doesn't seem like a big deal from a ux perspective, then I think this code is good-to-go.
Hi @darleendenno! Thank you for your feedback! I could see a use case where someone may want to only copy a certain section of the code block. Let me add some changes to allow that to happen. |
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.
❤️❤️❤️❤️ I LOVE THIS! ❤️❤️❤️❤️
Thank you for this improvement. Regression passes for me locally, and now users can copy full code blocks without highlighting. Great work!!
@shilman uncertain why chromatic is displaying a different baseline for the sidebar -- will let you sort that out. This is good to go on my end 👍 |
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.
Works great!!! 🏅 Thanks @melindali255!!
@melindali255 I've kept an eye on this pull request and one final thing we'd like from you if you don't mind. Could you jump in our Discord Server and message me (same username), as there's one item to address. Sounds good? Stay safe |
What I did
The keyboard shortcut for copying can be used to copy the source code of preview blocks. The source code does not need to be visible/expanded for the shortcut to work. After successfully copying, the action bar briefly displays a 'Copied' confirmation message.