Skip to content

Commit

Permalink
Ignore code block clicks with active selection (alex-shpak#448)
Browse files Browse the repository at this point in the history
  • Loading branch information
a-a-danilov authored Jul 4, 2022
1 parent 4ef38f3 commit c024538
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions assets/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement);

if (navigator.clipboard) {
Expand Down

0 comments on commit c024538

Please sign in to comment.