From 46c02807647bf61188267bfb05db0eeb53660be8 Mon Sep 17 00:00:00 2001 From: syuilo Date: Fri, 10 Dec 2021 01:22:22 +0900 Subject: refactor(client): :sparkles: --- packages/client/src/scripts/select-file.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'packages/client/src/scripts') 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 { 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 { + return select(src, label, false) as Promise; +} + +export function selectFiles(src: any, label: string | null = null): Promise { + return select(src, label, true) as Promise; +} -- cgit v1.2.3-freya