Make dialog default to only show supported formats

This commit is contained in:
JovannMC 2024-11-13 17:49:57 +03:00
parent b724f066ba
commit 80602cadf6
No known key found for this signature in database
3 changed files with 4 additions and 1 deletions

BIN
bun.lockb

Binary file not shown.

View File

@ -10,6 +10,7 @@
files: File[] | undefined;
onupload?: () => void;
isMobile: boolean;
acceptedFormats?: string[];
}
$effect(() => {
@ -20,7 +21,7 @@
let fileInput = $state<HTMLInputElement>();
let dragOver = $state(false);
let { files = $bindable(), onupload, isMobile }: Props = $props();
let { files = $bindable(), onupload, isMobile, acceptedFormats }: Props = $props();
function upload() {
if (!fileInput) return;
@ -108,6 +109,7 @@
class="hidden"
bind:this={fileInput}
onchange={addFiles}
accept={acceptedFormats?.join(",") ?? "*"}
multiple
/>

View File

@ -77,6 +77,7 @@
isMobile={data.isMobile}
bind:files={ourFiles}
onupload={runUpload}
acceptedFormats={converters.flatMap((c) => c.supportedFormats)}
/>
</div>