Skip to content

Commit

Permalink
fix(Viewer): fix taking sidebar position in fullscreen mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ShGKme committed Jun 8, 2023
1 parent 195bf9c commit 80ca372
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 10 deletions.
4 changes: 2 additions & 2 deletions js/viewer-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/viewer-main.js.map

Large diffs are not rendered by default.

17 changes: 10 additions & 7 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -941,24 +941,30 @@ export default {
this.nextFile.failed = true
},

takeSidebarPosition() {
const sidebarElement = document.querySelector('aside.app-sidebar')
this.sidebarPosition = sidebarElement?.getBoundingClientRect().left
},

/**
* Show the sharing sidebar
*/

async showSidebar() {
// Open the sidebar sharing tab
// TODO: also hide figure, needs a proper method for it in server Sidebar

if (OCA?.Files?.Sidebar) {
await OCA.Files.Sidebar.open(this.sidebarOpenFilePath)
// If OCA.Files.Sidebar has isFullScreenMode on, the sidebar is moved only after file loading
// So we need to take its new position after the loading
this.takeSidebarPosition()
}
},

handleAppSidebarOpen() {
this.isSidebarShown = true
this.takeSidebarPosition()
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarPosition = sidebar.getBoundingClientRect().left
this.trapElements = [sidebar]
}
},
Expand All @@ -969,10 +975,7 @@ export default {
},

onResize() {
const sidebar = document.querySelector('aside.app-sidebar')
if (sidebar) {
this.sidebarPosition = sidebar.getBoundingClientRect().left
}
this.takeSidebarPosition()
},

async onDelete() {
Expand Down

0 comments on commit 80ca372

Please sign in to comment.