fix: fallback for copy button
This commit is contained in:
@@ -92,11 +92,33 @@
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
copyConfirmationText() {
|
copyConfirmationText() {
|
||||||
navigator.clipboard.writeText(this.confirmationText);
|
if (navigator.clipboard && window.isSecureContext) {
|
||||||
this.copied = true;
|
navigator.clipboard.writeText(this.confirmationText)
|
||||||
setTimeout(() => {
|
.then(() => {
|
||||||
this.copied = false;
|
this.copied = true;
|
||||||
}, 2000);
|
setTimeout(() => {
|
||||||
|
this.copied = false;
|
||||||
|
}, 2000);
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
const textarea = document.createElement('textarea');
|
||||||
|
textarea.value = this.confirmationText;
|
||||||
|
textarea.style.position = 'fixed';
|
||||||
|
textarea.style.opacity = '0';
|
||||||
|
document.body.appendChild(textarea);
|
||||||
|
textarea.select();
|
||||||
|
try {
|
||||||
|
document.execCommand('copy');
|
||||||
|
this.copied = true;
|
||||||
|
setTimeout(() => {
|
||||||
|
this.copied = false;
|
||||||
|
}, 2000);
|
||||||
|
} catch (err) {
|
||||||
|
console.error('Failed to copy text:', err);
|
||||||
|
} finally {
|
||||||
|
document.body.removeChild(textarea);
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
toggleAction(id) {
|
toggleAction(id) {
|
||||||
const index = this.selectedActions.indexOf(id);
|
const index = this.selectedActions.indexOf(id);
|
||||||
|
|||||||
Reference in New Issue
Block a user