diff --git a/src/components/card/AttachmentList.vue b/src/components/card/AttachmentList.vue index 9e469fca4..394320b68 100644 --- a/src/components/card/AttachmentList.vue +++ b/src/components/card/AttachmentList.vue @@ -197,6 +197,9 @@ export default { return (attachment) => attachment?.extendedData?.info?.extension ?? (attachment?.name ?? attachment.data).split('.').pop() }, + cardDetailsInModal() { + return this.$store.getters.config('cardDetailsInModal') + }, }, watch: { cardId: { @@ -245,7 +248,17 @@ export default { }, showViewer(attachment) { if (attachment.extendedData.fileid && window.OCA.Viewer.availableHandlers.map(handler => handler.mimes).flat().includes(attachment.extendedData.mimetype)) { - window.OCA.Viewer.open({ path: attachment.extendedData.path }) + // Hide the sidebar if opening card in modal to avoid wrong sidebar position calculating in Viewer app + const sidebar = document.querySelector('aside.app-sidebar') + if (sidebar && this.cardDetailsInModal) { + sidebar.style.display = 'none' + } + const onClose = () => { + if (sidebar && sidebar.style.display === 'none') { + sidebar.style.display = '' + } + } + window.OCA.Viewer.open({ path: attachment.extendedData.path, onClose }) return }