Patch #40499 ยป replace-execCommand-with-Clipboard-API.patch
app/assets/javascripts/application.js | ||
---|---|---|
591 | 591 | |
592 | 592 |
function copyTextToClipboard(target) { |
593 | 593 |
if (target) { |
594 |
var temp = document.createElement('textarea'); |
|
595 |
temp.value = target.getAttribute('data-clipboard-text'); |
|
596 |
document.body.appendChild(temp); |
|
597 |
temp.select(); |
|
598 |
document.execCommand('copy'); |
|
599 |
if (temp.parentNode) { |
|
600 |
temp.parentNode.removeChild(temp); |
|
601 |
} |
|
594 |
const textToCopy = target.getAttribute('data-clipboard-text'); |
|
595 |
navigator.clipboard.writeText(textToCopy); |
|
596 | ||
602 | 597 |
if ($(target).closest('.drdn.expanded').length) { |
603 | 598 |
$(target).closest('.drdn.expanded').removeClass("expanded"); |
604 | 599 |
} |