diff --git a/client/components/modals/rssfeed/OpenCloseModal.vue b/client/components/modals/rssfeed/OpenCloseModal.vue
index 86dfeccf..1d7811ed 100644
--- a/client/components/modals/rssfeed/OpenCloseModal.vue
+++ b/client/components/modals/rssfeed/OpenCloseModal.vue
@@ -10,9 +10,7 @@
@@ -68,8 +66,7 @@ export default {
preventIndexing: true,
ownerName: '',
ownerEmail: ''
- },
- copiedToClipboard: false
+ }
}
},
watch: {
@@ -161,12 +158,6 @@ export default {
this.processing = false
})
},
- async copyToClipboard(str) {
- this.copiedToClipboard = await this.$copyToClipboard(str)
- setTimeout(() => {
- this.copiedToClipboard = false
- }, 2000)
- },
closeFeed() {
this.processing = true
this.$axios
diff --git a/client/components/modals/rssfeed/ViewFeedModal.vue b/client/components/modals/rssfeed/ViewFeedModal.vue
index ac594ed7..8fc13ff9 100644
--- a/client/components/modals/rssfeed/ViewFeedModal.vue
+++ b/client/components/modals/rssfeed/ViewFeedModal.vue
@@ -5,8 +5,7 @@
{{ $strings.HeaderRSSFeedGeneral }}
-
- {{ copiedToClipboard ? 'check' : 'content_copy' }}
+
@@ -56,8 +55,7 @@ export default {
},
data() {
return {
- processing: false,
- copiedToClipboard: false
+ processing: false
}
},
computed: {
@@ -75,16 +73,7 @@ export default {
feedUrl() {
return this.feed ? `${window.origin}${this.$config.routerBasePath}${this.feed.feedUrl}` : ''
}
- },
- methods: {
- async copyToClipboard(str) {
- this.copiedToClipboard = await this.$copyToClipboard(str)
- setTimeout(() => {
- this.copiedToClipboard = false
- }, 2000)
- }
- },
- mounted() {}
+ }
}
diff --git a/client/components/ui/TextInput.vue b/client/components/ui/TextInput.vue
index aaccd118..6e621870 100644
--- a/client/components/ui/TextInput.vue
+++ b/client/components/ui/TextInput.vue
@@ -7,8 +7,8 @@
{{ !showPassword ? 'visibility' : 'visibility_off' }}
-
-
{{ !hasCopied ? 'content_copy' : 'done' }}
+
+ {{ !hasCopied ? 'content_copy' : 'done' }}
@@ -47,7 +47,7 @@ export default {
showPassword: false,
isHovering: false,
isFocused: false,
- hasCopied: false,
+ hasCopied: null,
isInvalidDate: false
}
},
@@ -62,7 +62,12 @@ export default {
},
classList() {
var _list = []
- _list.push(`px-${this.paddingX}`)
+ if (this.showCopy) {
+ _list.push('pl-3', 'pr-8')
+ } else {
+ _list.push(`px-${this.paddingX}`)
+ }
+
_list.push(`py-${this.paddingY}`)
if (this.noSpinner) _list.push('no-spinner')
if (this.textCenter) _list.push('text-center')
@@ -80,11 +85,10 @@ export default {
},
methods: {
copyToClipboard() {
- if (this.hasCopied) return
+ clearTimeout(this.hasCopied)
this.$copyToClipboard(this.inputValue).then((success) => {
- this.hasCopied = success
- setTimeout(() => {
- this.hasCopied = false
+ this.hasCopied = setTimeout(() => {
+ this.hasCopied = null
}, 2000)
})
},
diff --git a/client/components/ui/TextInputWithLabel.vue b/client/components/ui/TextInputWithLabel.vue
index ee9ffb7a..a10394bd 100644
--- a/client/components/ui/TextInputWithLabel.vue
+++ b/client/components/ui/TextInputWithLabel.vue
@@ -6,7 +6,7 @@
{{ note }}
-
+
@@ -23,7 +23,8 @@ export default {
},
readonly: Boolean,
disabled: Boolean,
- inputClass: String
+ inputClass: String,
+ showCopy: Boolean
},
data() {
return {}
diff --git a/client/pages/config/users/_id/index.vue b/client/pages/config/users/_id/index.vue
index d19337af..fbef359b 100644
--- a/client/pages/config/users/_id/index.vue
+++ b/client/pages/config/users/_id/index.vue
@@ -14,11 +14,7 @@
{{ username }}
@@ -140,9 +136,6 @@ export default {
}
},
methods: {
- copyToClipboard(str) {
- this.$copyToClipboard(str, this)
- },
async init() {
this.listeningSessions = await this.$axios
.$get(`/api/users/${this.user.id}/listening-sessions?page=0&itemsPerPage=10`)
diff --git a/client/plugins/init.client.js b/client/plugins/init.client.js
index 984ec9d0..015cd919 100644
--- a/client/plugins/init.client.js
+++ b/client/plugins/init.client.js
@@ -128,12 +128,11 @@ Vue.prototype.$sanitizeSlug = (str) => {
return str
}
-Vue.prototype.$copyToClipboard = (str, ctx) => {
+Vue.prototype.$copyToClipboard = (str) => {
return new Promise((resolve) => {
if (navigator.clipboard) {
navigator.clipboard.writeText(str).then(
() => {
- if (ctx) ctx.$toast.success('Copied to clipboard')
resolve(true)
},
(err) => {
@@ -152,7 +151,6 @@ Vue.prototype.$copyToClipboard = (str, ctx) => {
document.execCommand('copy')
document.body.removeChild(el)
- if (ctx) ctx.$toast.success('Copied to clipboard')
resolve(true)
}
})