pancy fants
This commit is contained in:
parent
a4fd3a3556
commit
b6633d6f25
15 changed files with 339 additions and 116 deletions
14
src/utils/openFileDialog.ts
Normal file
14
src/utils/openFileDialog.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
export function openFileDialog(accept: string, multiple: boolean): Promise<FileList | null> {
|
||||
return new Promise((resolve) => {
|
||||
const inputEl = document.createElement('input')
|
||||
inputEl.type = 'file'
|
||||
inputEl.accept = accept
|
||||
inputEl.multiple = multiple
|
||||
|
||||
inputEl.addEventListener('change', () => {
|
||||
resolve(inputEl.files)
|
||||
})
|
||||
|
||||
inputEl.click()
|
||||
})
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue