Skip to content

Commit 0e5bc07

Browse files
Merge pull request #8005 from nextcloud/backport/7978/stable34
[stable34] fix: avoid breaking card details modal when viewing attachment
2 parents c141d6a + bb528ce commit 0e5bc07

1 file changed

Lines changed: 14 additions & 1 deletion

File tree

src/components/card/AttachmentList.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,6 +197,9 @@ export default {
197197
return (attachment) => attachment?.extendedData?.info?.extension
198198
?? (attachment?.name ?? attachment.data).split('.').pop()
199199
},
200+
cardDetailsInModal() {
201+
return this.$store.getters.config('cardDetailsInModal')
202+
},
200203
},
201204
watch: {
202205
cardId: {
@@ -245,7 +248,17 @@ export default {
245248
},
246249
showViewer(attachment) {
247250
if (attachment.extendedData.fileid && window.OCA.Viewer.availableHandlers.map(handler => handler.mimes).flat().includes(attachment.extendedData.mimetype)) {
248-
window.OCA.Viewer.open({ path: attachment.extendedData.path })
251+
// Hide the sidebar if opening card in modal to avoid wrong sidebar position calculating in Viewer app
252+
const sidebar = document.querySelector('aside.app-sidebar')
253+
if (sidebar && this.cardDetailsInModal) {
254+
sidebar.style.display = 'none'
255+
}
256+
const onClose = () => {
257+
if (sidebar && sidebar.style.display === 'none') {
258+
sidebar.style.display = ''
259+
}
260+
}
261+
window.OCA.Viewer.open({ path: attachment.extendedData.path, onClose })
249262
return
250263
}
251264

0 commit comments

Comments
 (0)