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