znicholasbrown / vuepress-plugin-code-copy

A Vuepress plugin that adds copy code buttons to all code blocks.
GNU General Public License v3.0
58 stars 13 forks source link

Add Option for Copy Icon to Remain Static #6

Closed ryannmedina closed 4 years ago

ryannmedina commented 4 years ago

Hi Nicholas! We're working on a documentation project and needed this copy button to remain static (instead of only showing when a user hovers over the code). I added the 'onHover' option/setting to allow users the choice. Hope that's helpful!

znicholasbrown commented 4 years ago

This is a great contribution @ryannmedina! My only suggestion would be that we make the hover functionality opt-out rather than opt-in, so as not to change existing implementations.

ryannmedina commented 4 years ago

Good suggestion @znicholasbrown! I just changed it. Let me know your thoughts.

The only thing I'm not super happy about is using a couple of important declarations in the CSS. Seemed unavoidable.

znicholasbrown commented 4 years ago

Looks good! Because the css block is scoped to this component, I think having important declarations is fine.