diff --git a/www/webapp/package.json b/www/webapp/package.json index ea5007562..e4f816015 100644 --- a/www/webapp/package.json +++ b/www/webapp/package.json @@ -17,7 +17,6 @@ "date-fns": "^2.30.0", "pinia": "^2.0.30", "vue": "~2.7.14", - "vue-clipboard2": "^0.3.3", "vue-router": "~3.6.5", "vuelidate": "^0.7.7", "vuetify": "^2.6.13" diff --git a/www/webapp/src/main.js b/www/webapp/src/main.js index dd10330a2..66982588e 100644 --- a/www/webapp/src/main.js +++ b/www/webapp/src/main.js @@ -2,7 +2,6 @@ import Vue from 'vue' import App from '@/App.vue' import router from '@/router' import vuetify from '@/plugins/vuetify' -import VueClipboard from 'vue-clipboard2' import VueRouter from 'vue-router' import Vuelidate from 'vuelidate' import "@fontsource/roboto/300.css" /* light */ @@ -15,8 +14,6 @@ import {createPinia, PiniaVuePlugin} from "pinia"; Vue.config.productionTip = false -VueClipboard.config.autoSetContainer = true -Vue.use(VueClipboard) Vue.use(Vuelidate) // `Pinia` replaces `vuex` as store. Vue.use(PiniaVuePlugin) diff --git a/www/webapp/src/views/DomainSetup.vue b/www/webapp/src/views/DomainSetup.vue index ac01e02a2..fdccea707 100644 --- a/www/webapp/src/views/DomainSetup.vue +++ b/www/webapp/src/views/DomainSetup.vue @@ -39,9 +39,7 @@
{{ ns.join('\n') }}
@@ -88,9 +86,7 @@
{{ t.data }}
@@ -193,11 +189,19 @@ export default { }, }, methods: { - copySuccess: function () { - this.showSnackbar("Copied to clipboard."); - }, - copyError: function () { - this.showSnackbar("Copy to clipboard failed. Please try again manually."); + copyToClipboard: async function (text) { + try { + await navigator.clipboard.writeText(text).then( + () => { + this.showSnackbar("Copied to clipboard."); + }, + () => { + this.showSnackbar("Copy to clipboard not allowed. Please try again manually."); + }, + ); + } catch (e) { + this.showSnackbar("Copy to clipboard failed. Please try again manually."); + } }, showSnackbar: function (text) { this.snackbar_text = text;