Skip to content

Commit a8f7bee

Browse files
Merge pull request #3058 from nextcloud/fix/3047/better-sidebar-support
fix: respect opened sidebar when showing the Viewer
2 parents 1d0d28a + 0e13021 commit a8f7bee

1 file changed

Lines changed: 19 additions & 0 deletions

File tree

apps/viewer/apps/viewer/src/views/Viewer.vue

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,6 +600,16 @@ export default defineComponent({
600600
// initial loading start
601601
this.initiated = true
602602
603+
const sidebar = document.querySelector('aside.app-sidebar')
604+
if (sidebar && sidebar.style.display !== 'none') {
605+
this.isSidebarShown = true
606+
this.sidebarPosition = sidebar.getBoundingClientRect().left
607+
this.trapElements = [sidebar]
608+
} else {
609+
this.isSidebarShown = false
610+
this.trapElements = []
611+
}
612+
603613
if (OCA?.Files?.Sidebar?.setFullScreenMode) {
604614
OCA.Files.Sidebar.setFullScreenMode(true)
605615
}
@@ -1417,6 +1427,15 @@ body:has(#viewer) {
14171427
width: calc(var(--app-sidebar-width) + var(--body-container-margin));
14181428
}
14191429
1430+
.app-navigation ~ #app-content-vue:has(~ #app-sidebar-vue:not([style*="display: none"])) {
1431+
flex-basis: calc(100% - 300px - clamp(300px, 27vw, 500px));
1432+
}
1433+
1434+
#app-content-vue:first-child:has(~ #app-sidebar-vue:not([style*="display: none"])),
1435+
.app-navigation--closed ~ #app-content-vue:has(~ #app-sidebar-vue:not([style*="display: none"])) {
1436+
flex-basis: calc(100% - clamp(300px, 27vw, 500px));
1437+
}
1438+
14201439
#header {
14211440
visibility: hidden;
14221441
}

0 commit comments

Comments
 (0)