Project

General

Profile

Patch #40499 ยป replace-execCommand-with-Clipboard-API.patch

Go MAEDA, 2024-03-30 10:00

View differences:

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");
}
    (1-1/1)