Merge pull request #428 from nextcloud/fix/copy_link_focus

Keep focus when copy Share-Link
This commit is contained in:
John Molakvoæ 2020-06-05 09:59:32 +02:00 committed by GitHub
commit c3f5808ac8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 3 deletions

View file

@ -184,7 +184,7 @@ export default {
}
},
async copyLink() {
async copyLink(event) {
if (this.$clipboard(this.formLink)) {
this.copySuccess = true
this.copied = true
@ -193,6 +193,9 @@ export default {
this.copied = true
console.debug('Not possible to copy share link')
}
// Set back focus as clipboard removes focus
event.target.focus()
setTimeout(() => {
this.copySuccess = false
this.copied = false

View file

@ -161,13 +161,15 @@ export default {
})
},
copyShareLink() {
copyShareLink(event) {
const $formLink = window.location.protocol + '//' + window.location.host + generateUrl(`/apps/forms/${this.form.hash}`)
if (this.$clipboard($formLink)) {
showSuccess(t('forms', 'Form link copied'))
} else {
showError(t('forms', 'Cannot copy, please copy the link manually'))
}
// Set back focus as clipboard removes focus
event.target.focus()
},
async loadFormResults() {

View file

@ -323,12 +323,14 @@ export default {
return datetime < moment().add(1, 'hour').toDate()
},
copyShareLink() {
copyShareLink(event) {
if (this.$clipboard(this.shareLink)) {
showSuccess(t('forms', 'Form link copied'))
} else {
showError(t('forms', 'Cannot copy, please copy the link manually'))
}
// Set back focus as clipboard removes focus
event.target.focus()
},
},
}