executablebooks / sphinx-copybutton

Add a "copy" button to code blocks in Sphinx
https://sphinx-copybutton.readthedocs.io/en/latest/
MIT License
249 stars 50 forks source link

Thoughts on dropping the dependency on clipboard.js? #97

Open pradyunsg opened 3 years ago

pradyunsg commented 3 years ago

Is your feature request related to a problem? Please describe.

https://www.npmjs.com/package/clipboard-js -- clipboard.js is a deprecated package, and all the relevant APIs are available as vanilla JS in modern browsers.

Describe the solution you'd like

See https://tomspencer.dev/blog/2018/09/14/adding-click-to-copy-buttons-to-a-hugo-powered-blog/#final-code, which describes the entirety of what JS is needed to cleanly implement the same functionality on modern browsers.

Describe alternatives you've considered

Status quo? IDK any good alternatives to be honest.

Additional context

Nothing. I just realized that all Sphinx extensions that I generally recommend, are all now projects under the executablebooks umbrella. :)

welcome[bot] commented 3 years ago

Thanks for opening your first issue here! Engagement like this is essential for open source projects! :hugs:
If you haven't done so already, check out EBP's Code of Conduct. Also, please try to follow the issue template as it helps other community members to contribute more effectively.
If your issue is a feature request, others may react to it, to raise its prominence (see Feature Voting).
Welcome to the EBP community! :tada:

choldgraf commented 3 years ago

I'm totally fine with it as long as the behavior stays the same. I used clipboard.js originally just because I'm not a JS developer and that was the fastest path towards getting a working functionality :-)

nijel commented 1 year ago

https://github.com/executablebooks/sphinx-copybutton/pull/206 should address this.