Skip to content

Commit

Permalink
Merge pull request #697 from nextcloud/fix/582
Browse files Browse the repository at this point in the history
fix(sidebar): fix copy to clipboard on error message
  • Loading branch information
Florian authored Nov 17, 2023
2 parents 95f0c6f + 4724991 commit f8393c5
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/modules/sidebar/sections/SidebarIntegration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -75,24 +75,23 @@ export default {
},
},
methods: {
async copyUrl() {
document.querySelector('input#urlTextField').select()
if (!navigator.clipboard) {
copyUrl() {
if (navigator?.clipboard) {
navigator.clipboard.writeText(this.webdavUrl).then(function() {
showSuccess(t('files', 'Integration URL copied to clipboard'))
}, function(err) {
showError(t('files', 'Clipboard is not available'))
console.error('Async: Could not copy text: ', err)
})
} else {
try {
document.querySelector('input#urlTextField').select()
document.execCommand('copy')
showSuccess(t('files', 'Integration URL copied to clipboard'))
} catch (e) {
showError(t('files', 'Clipboard is not available'))
return
}
} else {
await navigator.clipboard.writeText(this.webdavUrl)
}
this.copied = true
showSuccess(t('files', 'Integration URL copied to clipboard'))
setTimeout(() => {
this.copied = false
}, 5000)
},
},
}
Expand Down

0 comments on commit f8393c5

Please sign in to comment.