From 639b72bf7e91c822de0acd0f3591c53500a04469 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Julius=20H=C3=A4rtl?= Date: Wed, 12 Jul 2023 16:23:11 +0200 Subject: [PATCH] fix: Avoid opening the link picker twice MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Julius Härtl --- src/view/Office.vue | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/view/Office.vue b/src/view/Office.vue index 06ad0c4932..3659d84abc 100644 --- a/src/view/Office.vue +++ b/src/view/Office.vue @@ -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' @@ -136,7 +135,9 @@ export default { loadingTimeout: null, error: null, views: [], + showZotero: false, + showLinkPicker: false, } }, computed: { @@ -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) @@ -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) { @@ -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) } },