mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2025-07-21 03:14:38 +02:00
Update copy to clipboard buttons to be standardized
This commit is contained in:
parent
c3c846f82d
commit
598a93d224
8 changed files with 33 additions and 53 deletions
|
@ -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)
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue