documentation icon indicating copy to clipboard operation
documentation copied to clipboard

Site: Implement a button to copy code

Open EdwardAngert opened this issue 3 years ago • 0 comments

Re: code blocks

Issue Description

  • As a user who needs to copy commands and sections of code, I want to click a button to copy to clipboard instead of highlighting lines of text.

How will this impact users?

  • It'll make it easier to copy code!

Suggested Resolution

  • Possible plugin: https://www.npmjs.com/package/clipboard
  • here’s how folks did it in the Gatsby docs: https://github.com/gatsbyjs/gatsby/pull/15834

Additional Information

  • Digging through the code, this functionality might've already existed on the site:
    • ZeroClipboard: https://github.com/pantheon-systems/documentation/blob/main/source/docs/assets/js/src/application.js#L128
    • clipboardy: https://github.com/pantheon-systems/documentation/blob/main/package-lock.json#L8036

EdwardAngert avatar Apr 03 '23 15:04 EdwardAngert