enso/app/gui2/env.d.ts
Adam Obuchowicz 70f847f295
Fix file browser on Linux and Windows (#9538)
Fixes #9503

[The `showFileBrowser` documentation has a note](https://www.electronjs.org/docs/latest/api/dialog#dialogshowopendialogsyncbrowserwindow-options), that Linux and Windows don't support enabling picking dir and file.
2024-03-25 17:07:04 +00:00

30 lines
905 B
TypeScript

/// <reference types="vite/client" />
declare const PROJECT_MANAGER_URL: string
declare const RUNNING_VITEST: boolean
declare const IS_CLOUD_BUILD: boolean
interface Document {
caretPositionFromPoint(x: number, y: number): { offsetNode: Node; offset: number } | null
}
interface Window {
fileBrowserApi: FileBrowserApi
}
/** `window.fileBrowserApi` is a context bridge to the main process, when we're running in an
* Electron context.
*
* # Safety
*
* We're assuming that the main process has exposed the `fileBrowserApi` context bridge (see
* `app/ide-desktop/lib/client/src/preload.ts` for details), and that it contains the functions defined in this
* interface.
*/
interface FileBrowserApi {
/** Select path for local file or directory using the system file browser. */
readonly openFileBrowser: (
kind: 'file' | 'directory' | 'default',
) => Promise<string[] | undefined>
}