Skip to content
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

add copy button for code block #25

Open
Zilong-Li opened this issue Jul 21, 2021 · 2 comments
Open

add copy button for code block #25

Zilong-Li opened this issue Jul 21, 2021 · 2 comments

Comments

@Zilong-Li
Copy link

Hi @gongzhitaao

Thanks for your great work on this.

I wonder if you can add a copy button for code block so that people can copy the code snippets quickly, especially for long and large blocks.

@gongzhitaao
Copy link
Owner

Hey Zilong,

Good suggestion, let me see how easy it will be for a pure css solution.

@Zilong-Li
Copy link
Author

Zilong-Li commented Jul 22, 2021

Hi,

I don't think there is a good solution to copy text to clipboard with one click button for pure css, although I am not an expert on css. Alternatively, maybe we can make the code block copiable when moving mouse to the block using hover feature so that people can Ctrl/Cmd+C to copy. check this https://stackoverflow.com/questions/44418687/making-text-selectable-on-hover-with-css. But this is not good solution for mobile device. I think using js is inevitable if you want to make it work across all devices.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants