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 4794a82 commit 5730cc6
Show file tree
Hide file tree
Showing 12 changed files with 162,660 additions and 218 deletions.
13,248 changes: 13,245 additions & 3 deletions js/viewer-components.js

Large diffs are not rendered by default.

28 changes: 0 additions & 28 deletions js/viewer-components.js.LICENSE.txt

This file was deleted.

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

Large diffs are not rendered by default.

92,575 changes: 92,572 additions & 3 deletions js/viewer-filerobot.js

Large diffs are not rendered by default.

68 changes: 0 additions & 68 deletions js/viewer-filerobot.js.LICENSE.txt

This file was deleted.

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

Large diffs are not rendered by default.

56,741 changes: 56,738 additions & 3 deletions js/viewer-main.js

Large diffs are not rendered by default.

99 changes: 0 additions & 99 deletions js/viewer-main.js.LICENSE.txt

This file was deleted.

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

Large diffs are not rendered by default.

93 changes: 91 additions & 2 deletions js/viewer-plyr.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

18 changes: 10 additions & 8 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,6 @@ export default {
beforeOpen() {
// initial loading start
this.initiated = true
if (OCA?.Files?.Sidebar?.setFullScreenMode) {
OCA.Files.Sidebar.setFullScreenMode(true)
}
Expand Down Expand Up @@ -941,24 +940,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 +974,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 5730cc6

Please sign in to comment.