diff --git a/src/nginxconfig/templates/setup.vue b/src/nginxconfig/templates/setup.vue index 2a38621..88251e8 100644 --- a/src/nginxconfig/templates/setup.vue +++ b/src/nginxconfig/templates/setup.vue @@ -100,7 +100,7 @@ THE SOFTWARE. }, }, mounted() { - this.setupCopy(); + this.setupCopy(this.$refs.copyTar); }, methods: { tabClass(tab) { @@ -148,27 +148,27 @@ THE SOFTWARE. const b64 = btoa(String.fromCharCode(...contents)); return `echo '${b64}' | base64 --decode | tee ${this.$props.data.global.nginx.nginxConfigDirectory.computed}/${this.tarName} > /dev/null`; }, - setupCopy() { - const originalText = this.$refs.copyTar.textContent; + setupCopy(elm) { + const originalText = elm.textContent; const resetText = () => { setTimeout(() => { - this.$refs.copyTar.textContent = originalText; + elm.textContent = originalText; }, 5000); }; - const clipboard = new ClipboardJS(this.$refs.copyTar, { + const clipboard = new ClipboardJS(elm, { text: this.copyTar, }); clipboard.on('success', e => { - this.$refs.copyTar.textContent = 'Copied'; + elm.textContent = 'Copied'; e.clearSelection(); resetText(); }); clipboard.on('error', () => { - this.$refs.copyTar.textContent = 'Press Ctrl + C to copy'; + elm.textContent = 'Press Ctrl + C to copy'; resetText(); }); }, diff --git a/src/nginxconfig/templates/setup_sections/download.vue b/src/nginxconfig/templates/setup_sections/download.vue index 233f8ee..6b8e440 100644 --- a/src/nginxconfig/templates/setup_sections/download.vue +++ b/src/nginxconfig/templates/setup_sections/download.vue @@ -39,7 +39,7 @@ THE SOFTWARE.

{{ i18n.templates.setupSections.download.or }} - + {{ i18n.templates.setupSections.download.copyBase64StringOfCompressedConfig }} @@ -94,5 +94,8 @@ THE SOFTWARE. i18n, }; }, + mounted() { + this.$parent.setupCopy(this.$refs.copyTar); + }, };