Clear file input when removing files

This commit is contained in:
Mel O'Hagan 2022-11-01 16:43:18 +00:00
parent 702e7fe184
commit ebeae5742a
1 changed files with 3 additions and 0 deletions

View File

@ -43,6 +43,7 @@
let selectedImageIdx = 0 let selectedImageIdx = 0
let fileDragged = false let fileDragged = false
let selectedUrl let selectedUrl
let fileInput
$: selectedImage = value?.[selectedImageIdx] ?? null $: selectedImage = value?.[selectedImageIdx] ?? null
$: fileCount = value?.length ?? 0 $: fileCount = value?.length ?? 0
$: isImage = $: isImage =
@ -102,6 +103,7 @@
await deleteAttachments( await deleteAttachments(
value.filter((x, idx) => idx === selectedImageIdx).map(item => item.key) value.filter((x, idx) => idx === selectedImageIdx).map(item => item.key)
) )
fileInput.value = ""
} }
selectedImageIdx = 0 selectedImageIdx = 0
} }
@ -234,6 +236,7 @@
type="file" type="file"
multiple multiple
accept={extensions} accept={extensions}
bind:this={fileInput}
on:change={handleFile} on:change={handleFile}
/> />
<svg <svg