feat(v2): CodeBlock copy button#1643
Merged
endiliey merged 2 commits intofacebook:masterfrom Jul 12, 2019
Merged
Conversation
Contributor
|
Deploy preview for docusaurus-2 ready! Built with commit f0d052c |
Contributor
|
Deploy preview for docusaurus-preview ready! Built with commit f0d052c |
endiliey
suggested changes
Jul 9, 2019
Contributor
Author
|
Oh wow, what a blunder 😦 Pushed a fix, works now |
Contributor
endiliey
approved these changes
Jul 10, 2019
yangshun
approved these changes
Jul 12, 2019
Contributor
ideally if we want to avoid duplication we have to make one as another dependency. But i think its out of this PR scope. |
Contributor
|
lets merge this out first ? |
Contributor
|
Thanks a lot @bvego you are awesome |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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/installationI've only wrapped the
preelement with adivthat acts as a wrapper and use it for anchoring the position of the copy button.I've used the
clipboardpackage for copying because I saw it elsewhere in the repoEdit:
I also noticed that
packages/docusaurus-theme-live-codeblock/src/theme/CodeBlock/styles.module.cssandpackages/docusaurus-theme-classic/src/theme/CodeBlock/styles.module.cssare missing the copyright notice on the top.Maybe it's indented but just wanted point it out if it slipped through.