openshift-evangelists / workshopper

Workshop content rendering tool
63 stars 41 forks source link

Add copy/paste link to code blocks #46

Closed thoraxe closed 6 years ago

thoraxe commented 6 years ago

Would be great if there was a "copy to clipboard" button for code blocks.

Currently triple-clicking shell commands results in copying a carriage return into the buffer, which really stinks for commands that need modification before submission.

thoraxe commented 6 years ago

Looks like jQuery and, in general, Javascript supports doing this:

https://stackoverflow.com/questions/22581345/click-button-copy-to-clipboard-using-jquery#30905277

My guess would be that we need some kind of declaration to add to the text block that tells it to have a copy button, and that the copy button should get generated with the id of the text block so that it can slurp the contents into the clipboard.

marekjelen commented 6 years ago

Implemented in new version, will release ASAP for testing.