Skip to content

Commit

Permalink
fix: Avoid opening the link picker twice
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Härtl <[email protected]>
  • Loading branch information
juliushaertl authored and backportbot-nextcloud[bot] committed Jul 13, 2023
1 parent fa9ec92 commit 639b72b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/view/Office.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ import FilesAppIntegration from './FilesAppIntegration.js'
import { LOADING_ERROR, checkCollaboraConfiguration, checkProxyStatus } from '../services/collabora.js'
import { enableScrollLock, disableScrollLock } from '../helpers/safariFixer.js'
import { getLinkWithPicker } from '@nextcloud/vue/dist/Components/NcRichText.js'
import { showError } from '@nextcloud/dialogs'
import axios from '@nextcloud/axios'
import { generateOcsUrl } from '@nextcloud/router'
Expand Down Expand Up @@ -136,7 +135,9 @@ export default {
loadingTimeout: null,
error: null,
views: [],
showZotero: false,
showLinkPicker: false,
}
},
computed: {
Expand Down Expand Up @@ -227,6 +228,10 @@ export default {
},
async pickLink() {
try {
if (this.showLinkPicker) {
return
}
this.showLinkPicker = true
const link = await getLinkWithPicker(null, true)
try {
const url = new URL(link)
Expand All @@ -239,8 +244,9 @@ export default {
}
PostMessages.sendWOPIPostMessage(FRAME_DOCUMENT, 'Action_Paste', { Mimetype: 'text/plain', Data: link })
} catch (e) {
showError(t('richdocuments', 'Failed to get a link with the picker'))
console.error('Link picker promise rejected :', e)
} finally {
this.showLinkPicker = false
}
},
async resolveLink(url) {
Expand Down Expand Up @@ -271,7 +277,6 @@ export default {
PostMessages.sendWOPIPostMessage(FRAME_DOCUMENT, 'Action_GetLinkPreview_Resp', { url, title, image: null })
}
} catch (e) {
showError(t('richdocuments', 'Failed to get the link preview'))
console.error('Error resolving a reference', e)
}
},
Expand Down

0 comments on commit 639b72b

Please sign in to comment.