Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/files/src/eventbus.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ declare module '@nextcloud/event-bus' {

'files:sidebar:opened': INode
'files:sidebar:closed': undefined

'viewer:sidebar:open': { source: string }
}
}

Expand Down
4 changes: 1 addition & 3 deletions apps/files/src/services/RouterService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,7 @@ export default class RouterService {
query?: Record<string, string | (string | null)[] | null | undefined>,
replace?: boolean,
): Promise<Route> {
if (!name) {
name = this.router.currentRoute.name as string
}
name ??= this.router.currentRoute.name as string
const location: Location = { name, query, params }
if (replace) {
return this._router.replace(location)
Expand Down
12 changes: 12 additions & 0 deletions apps/files/src/store/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { defineStore } from 'pinia'
import { computed, ref, watch } from 'vue'
import logger from '../logger.ts'
import { useActiveStore } from './active.ts'
import { useFilesStore } from './files.ts'

export const useSidebarStore = defineStore('sidebar', () => {
const activeTab = ref<string>()
Expand Down Expand Up @@ -127,6 +128,17 @@ export const useSidebarStore = defineStore('sidebar', () => {
}
})

subscribe('viewer:sidebar:open', ({ source }) => {
const filesStore = useFilesStore()
const node = filesStore.getNode(source)
if (node) {
logger.debug('Opening sidebar for node from Viewer.', { node })
open(node)
} else {
logger.error(`Cannot open sidebar for node '${source}' because it was not found in the current view.`)
}
})

let initialized = false
// close sidebar when parameter is removed from url
subscribe('files:list:updated', () => {
Expand Down
Loading