wcoder / highlightjs-line-numbers.js

Line numbering plugin for Highlight.js
https://wcoder.github.io/highlightjs-line-numbers.js/
MIT License
541 stars 125 forks source link

Fix copy / paste behavior when using Firefox or Edge [Clipboard / Selection API] (#51) #62

Closed anlambert closed 5 years ago

anlambert commented 5 years ago

This PR is another attempt to fix #51 but using an approach different from the one in #60 (as pointed here).

Here, the copy / paste issue when using Firefox or Edge is resolved using the Clipboard API and the Selection API.

Apart a workaround needed for Microsoft Edge, I find that solution much more elegant and less complicated than the first one I have already submitted (#60). Also, there is no changes in the HTML layout and considering the APIs mentioned above seem widely supported, I think this solution should be preferred.

CSS selectors improvements as introduced in #60 are also still part of that new PR.