Ignore code block clicks with active selection (#448)

This commit is contained in:
Alexander Danilov 2022-07-04 09:55:54 +03:00 committed by GitHub
parent 4ef38f3bbf
commit c024538604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -11,6 +11,9 @@
document.querySelectorAll("pre code").forEach(code => { document.querySelectorAll("pre code").forEach(code => {
code.addEventListener("click", function (event) { code.addEventListener("click", function (event) {
if (window.getSelection().toString()) {
return;
}
select(code.parentElement); select(code.parentElement);
if (navigator.clipboard) { if (navigator.clipboard) {