Skip to content

Commit

Permalink
Merge pull request #2608 from nextcloud/artonge/backport/stable30/2605
Browse files Browse the repository at this point in the history
[stable30] fix: Usage of pushToHistory function on prev/next
  • Loading branch information
sorbaugh authored Nov 5, 2024
2 parents 906aa12 + 95eeb87 commit 7c8f7b6
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 11 deletions.

Large diffs are not rendered by default.

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-yNbwR0sN.chunk.css';
@import './main-Df4lLTaD.chunk.css';
@import './logger-B6WZzrWi.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.

2 changes: 1 addition & 1 deletion 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/files_actions/viewerAction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,16 @@ async function execAction(node: Node, view: View, dir: string): Promise<boolean|
}

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

return null
}
Expand Down
7 changes: 3 additions & 4 deletions src/views/Viewer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -1020,31 +1020,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 7c8f7b6

Please sign in to comment.