diff options
Diffstat (limited to 'packages/client/src/scripts')
| -rw-r--r-- | packages/client/src/scripts/select-file.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/packages/client/src/scripts/select-file.ts b/packages/client/src/scripts/select-file.ts index 0c6bd7ccde..6019890444 100644 --- a/packages/client/src/scripts/select-file.ts +++ b/packages/client/src/scripts/select-file.ts @@ -1,8 +1,9 @@ import * as os from '@/os'; import { i18n } from '@/i18n'; import { defaultStore } from '@/store'; +import { DriveFile } from 'misskey-js/built/entities'; -export function selectFile(src: any, label: string | null, multiple = false) { +function select(src: any, label: string | null, multiple: boolean): Promise<DriveFile | DriveFile[]> { return new Promise((res, rej) => { const chooseFileFromPc = () => { const input = document.createElement('input'); @@ -86,3 +87,11 @@ export function selectFile(src: any, label: string | null, multiple = false) { }], src); }); } + +export function selectFile(src: any, label: string | null = null): Promise<DriveFile> { + return select(src, label, false) as Promise<DriveFile>; +} + +export function selectFiles(src: any, label: string | null = null): Promise<DriveFile[]> { + return select(src, label, true) as Promise<DriveFile[]>; +} |