Update copy to clipboard buttons to be standardized

This commit is contained in:
advplyr 2025-01-22 17:56:46 -06:00
parent c3c846f82d
commit 598a93d224
8 changed files with 33 additions and 53 deletions

View file

@ -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)
}
})