Skip to content

Commit

Permalink
fix: Usage of pushToHistory function on prev/next
Browse files Browse the repository at this point in the history
Signed-off-by: Louis Chemineau <[email protected]>
  • Loading branch information
artonge committed Nov 4, 2024
1 parent 7baa965 commit d24ed76
Show file tree
Hide file tree
Showing 10 changed files with 35 additions and 14 deletions.
10 changes: 10 additions & 0 deletions css/main-DA7qfHYK.chunk.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions css/viewer-main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
/* extracted by css-entry-points-plugin */
@import './main-DA7qfHYK.chunk.css';
@import './logger-B6WZzrWi.chunk.css';
4 changes: 2 additions & 2 deletions js/viewer-init.js

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

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.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/services/FilesActionHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,16 @@ function filesActionHandler(node, view, dir) {
window.OCP.Files.Router.goToRoute(null, window.OCP.Files.Router.params, newQuery)
}
pushToHistory(node, view, dir)
OCA.Viewer.open({ path, onPrev: pushToHistory, onNext: pushToHistory, onClose })
window.OCA.Viewer.open({
path,
onPrev(fileInfo) {
pushToHistory(fileInfo, view, dir)
},
onNext(fileInfo) {
pushToHistory(fileInfo, view, dir)
},
onClose,
})
}

/**
Expand Down
7 changes: 3 additions & 4 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1016,31 +1016,30 @@ export default {
* Open previous available file
*/
previous() {
const oldFileInfo = this.fileList[this.currentIndex]
this.currentIndex--
if (this.currentIndex < 0) {
this.currentIndex = this.fileList.length - 1
}
const fileInfo = this.fileList[this.currentIndex]
this.openFileFromList(fileInfo)
this.Viewer.onPrev(fileInfo, oldFileInfo)
this.Viewer.onPrev(fileInfo)
this.updateTitle(this.currentFile.basename)
},
/**
* Open next available file
*/
next() {
const oldFileInfo = this.fileList[this.currentIndex]
this.currentIndex++
if (this.currentIndex > this.fileList.length - 1) {
this.currentIndex = 0
}
const fileInfo = this.fileList[this.currentIndex]
this.openFileFromList(fileInfo)
this.Viewer.onNext(fileInfo, oldFileInfo)
this.Viewer.onNext(fileInfo)
this.updateTitle(this.currentFile.basename)
},
Expand Down

0 comments on commit d24ed76

Please sign in to comment.