mirror of
https://github.com/nextcloud/server.git
synced 2026-02-18 18:28:50 -05:00
fix(files): properly type window Files APIs
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
This commit is contained in:
parent
776a689e09
commit
971dfd7cbf
3 changed files with 40 additions and 12 deletions
|
|
@ -2,7 +2,6 @@
|
|||
* SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
import type { Pinia } from 'pinia'
|
||||
import { getCSPNonce } from '@nextcloud/auth'
|
||||
import { PiniaVuePlugin } from 'pinia'
|
||||
import Vue from 'vue'
|
||||
|
|
@ -16,16 +15,6 @@ import SettingsService from './services/Settings.js'
|
|||
|
||||
__webpack_nonce__ = getCSPNonce()
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
OC: Nextcloud.v29.OC
|
||||
OCP: Nextcloud.v29.OCP
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
OCA: Record<string, any>
|
||||
_nc_files_pinia: Pinia
|
||||
}
|
||||
}
|
||||
|
||||
// Init private and public Files namespace
|
||||
window.OCA.Files = window.OCA.Files ?? {}
|
||||
window.OCP.Files = window.OCP.Files ?? {}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ export const action = new FileAction({
|
|||
// You need read permissions to see the sidebar
|
||||
if ((node.permissions & Permission.READ) !== 0) {
|
||||
window.OCA?.Files?.Sidebar?.setActiveTab?.('sharing')
|
||||
return sidebarAction.exec(node, view, dir)
|
||||
return await sidebarAction.exec(node, view, dir)
|
||||
}
|
||||
return null
|
||||
},
|
||||
|
|
|
|||
39
window.d.ts
vendored
Normal file
39
window.d.ts
vendored
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
/**
|
||||
* SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import type RouterService from './apps/files/src/services/RouterService'
|
||||
import type Settings from './apps/files/src/services/Settings'
|
||||
import type Sidebar from './apps/files/src/services/Sidebar'
|
||||
|
||||
type SidebarAPI = Sidebar & {
|
||||
open: (path: string) => Promise<void>
|
||||
close: () => void
|
||||
setFullScreenMode: (fullScreen: boolean) => void
|
||||
setShowTagsDefault: (showTagsDefault: boolean) => void
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
OC: Nextcloud.v29.OC
|
||||
|
||||
// Private Files namespace
|
||||
OCA: {
|
||||
Files: {
|
||||
Settings: Settings
|
||||
Sidebar: SidebarAPI
|
||||
}
|
||||
} & Record<string, any> // eslint-disable-line @typescript-eslint/no-explicit-any
|
||||
|
||||
// Public Files namespace
|
||||
OCP: {
|
||||
Files: {
|
||||
Router: RouterService
|
||||
}
|
||||
} & Nextcloud.v29.OCP
|
||||
|
||||
// Private global files pinia store
|
||||
_nc_files_pinia: Pinia
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue