Clear file input when removing files

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

View File

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