-
-
Notifications
You must be signed in to change notification settings - Fork 8.8k
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
feat(v2): CodeBlock copy button #1643
Conversation
Deploy preview for docusaurus-2 ready! Built with commit f0d052c |
Deploy preview for docusaurus-preview ready! Built with commit f0d052c |
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.
Oh wow, what a blunder 😦 Pushed a fix, works now |
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.
ideally if we want to avoid duplication we have to make one as another dependency. But i think its out of this PR scope. |
lets merge this out first ? |
Thanks a lot @bvego you are awesome |
Motivation
Hi there. The motivation behind this was so many websites that don't have the copy button.
The design was pretty much eyeballed but is open for suggestions. I chose not to go with an icon here.
Attempts to close #1587
Have you read the Contributing Guidelines on pull requests?
Yes
Test Plan
http://localhost:3000/docs/installation
I've only wrapped the
pre
element with adiv
that acts as a wrapper and use it for anchoring the position of the copy button.I've used the
clipboard
package for copying because I saw it elsewhere in the repoEdit:
I also noticed that
packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.css
andpackages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.css
are missing the copyright notice on the top.Maybe it's indented but just wanted point it out if it slipped through.