Skip to content

Commit 485844f

Browse files
committed
fix: Usage of pushToHistory function on prev/next
Signed-off-by: Louis Chemineau <louis@chmn.me>
1 parent dcb8705 commit 485844f

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/files_actions/viewerAction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ async function execAction(node: Node, view: View, dir: string): Promise<boolean|
3737
}
3838

3939
pushToHistory(node, view, dir)
40-
window.OCA.Viewer.open({ path: node.path, onPrev: pushToHistory, onNext: pushToHistory, onClose })
40+
window.OCA.Viewer.open({ path: node.path, onPrev(fileInfo) { pushToHistory(fileInfo, view, dir) }, onNext(fileInfo) { pushToHistory(fileInfo, view, dir) }, onClose })
4141

4242
return null
4343
}

src/views/Viewer.vue

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -984,31 +984,30 @@ export default {
984984
* Open previous available file
985985
*/
986986
previous() {
987-
const oldFileInfo = this.fileList[this.currentIndex]
988987
this.currentIndex--
989988
if (this.currentIndex < 0) {
990989
this.currentIndex = this.fileList.length - 1
991990
}
992991
993992
const fileInfo = this.fileList[this.currentIndex]
994993
this.openFileFromList(fileInfo)
995-
this.Viewer.onPrev(fileInfo, oldFileInfo)
994+
this.Viewer.onPrev(fileInfo)
996995
this.updateTitle(this.currentFile.basename)
997996
},
998997
999998
/**
1000999
* Open next available file
10011000
*/
10021001
next() {
1003-
const oldFileInfo = this.fileList[this.currentIndex]
10041002
this.currentIndex++
10051003
if (this.currentIndex > this.fileList.length - 1) {
10061004
this.currentIndex = 0
10071005
}
10081006
10091007
const fileInfo = this.fileList[this.currentIndex]
10101008
this.openFileFromList(fileInfo)
1011-
this.Viewer.onNext(fileInfo, oldFileInfo)
1009+
this.Viewer.onNext(fileInfo)
1010+
10121011
this.updateTitle(this.currentFile.basename)
10131012
},
10141013

0 commit comments

Comments
 (0)