Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: fallback for copy button

peaklabs-deva374e09d19d6
diff --git a/resources/views/components/modal-confirmation.blade.php b/resources/views/components/modal-confirmation.blade.php
index 8495417ac5..6f1dad8c98 100644
--- a/resources/views/components/modal-confirmation.blade.php
+++ b/resources/views/components/modal-confirmation.blade.php
@@ -92,11 +92,33 @@
});
},
copyConfirmationText() {
- navigator.clipboard.writeText(this.confirmationText);
- this.copied = true;
- setTimeout(() => {
- this.copied = false;
- }, 2000);
+ if (navigator.clipboard && window.isSecureContext) {
+ navigator.clipboard.writeText(this.confirmationText)
+ .then(() => {
+ this.copied = true;
+ 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) {
const index = this.selectedActions.indexOf(id);