Make dialog default to only show supported formats

This commit is contained in:
JovannMC 2024-11-13 17:49:57 +03:00 committed by not-nullptr
parent 00a855e590
commit 71e26cc3c3
2 changed files with 4 additions and 1 deletions

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

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