highlight-loader icon indicating copy to clipboard operation
highlight-loader copied to clipboard

Adding "Copy to Clipboard"

Open shakiba opened this issue 7 years ago • 2 comments

I would like to add a copy to clipboard option to the code section. I wonder how I can do it.

One option is to add the button using css :after and then listen to click events. However I still need to be able to get raw content from somewhere. Is it possible to add it as, for example, data-raw attribute to the code element?

shakiba avatar May 22 '18 20:05 shakiba

I solved this by adding $e.parent().attr('data-raw-code', text); to replaceWith() callback.

shakiba avatar May 24 '18 00:05 shakiba

Cool. You could perhaps PR that as a doc improvement.

bebraw avatar May 24 '18 08:05 bebraw