Skip to content

Commit 17885f7

Browse files
committed
fix(viewerAction): Adjust to new @nextcloud/files 4.0 API
Signed-off-by: Jonas <[email protected]>
1 parent 9b0e594 commit 17885f7

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

src/files_actions/viewerAction.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,8 @@ const onPopState = () => {
5656

5757
/**
5858
* Execute the viewer files action
59-
* @param node The active node
60-
* @param view The current view
61-
* @param dir The current path
6259
*/
63-
async function execAction(node: Node, view: View, dir: string): Promise<boolean|null> {
60+
async function execAction({ nodes, view, folder }): Promise<boolean|null> {
6461
const onClose = () => {
6562
// If there is no router, we're in standalone mode
6663
if (!window.OCP?.Files?.Router) {
@@ -78,14 +75,14 @@ async function execAction(node: Node, view: View, dir: string): Promise<boolean|
7875
window.addEventListener('popstate', onPopState)
7976
}
8077

81-
pushToHistory(node, view, dir)
78+
pushToHistory(nodes[0], view, folder.path)
8279
window.OCA.Viewer.open({
83-
path: node.path,
80+
path: nodes[0].path,
8481
onPrev(fileInfo) {
85-
pushToHistory(fileInfo, view, dir)
82+
pushToHistory(fileInfo, view, folder.path)
8683
},
8784
onNext(fileInfo) {
88-
pushToHistory(fileInfo, view, dir)
85+
pushToHistory(fileInfo, view, folder.path)
8986
},
9087
onClose,
9188
})
@@ -102,9 +99,9 @@ export function registerViewerAction() {
10299
displayName: () => t('viewer', 'View'),
103100
iconSvgInline: () => svgEye,
104101
default: DefaultType.DEFAULT,
105-
enabled: (nodes) => {
102+
enabled: ({ nodes }) => {
106103
// Disable if not located in user root
107-
if (nodes.some(node => !(node.isDavRessource && node.root?.startsWith('/files')))) {
104+
if (nodes.some(node => !(node.isDavResource && node.root?.startsWith('/files')))) {
108105
return false
109106
}
110107

0 commit comments

Comments
 (0)