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 77c8e49 commit eacf38d
Show file tree
Hide file tree
Showing 10 changed files with 47 additions and 11 deletions.
4 changes: 4 additions & 0 deletions css/main--fK07A8K.chunk.css

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions css/main-DA7qfHYK.chunk.css

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions css/main-DnH6w7F4.chunk.css

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

2 changes: 1 addition & 1 deletion css/viewer-main.css
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/* extracted by css-entry-points-plugin */
@import './main--fK07A8K.chunk.css';
@import './main-DnH6w7F4.chunk.css';
@import './logger-B5Yp6f8I.chunk.css';
2 changes: 1 addition & 1 deletion js/viewer-init.mjs

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/viewer-main.mjs

Large diffs are not rendered by default.

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

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion src/services/FilesActionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,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 @@ -1017,31 +1017,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 eacf38d

Please sign in to comment.