mirror of https://github.com/VERT-sh/VERT.git
Make dialog default to only show supported formats
This commit is contained in:
parent
b724f066ba
commit
80602cadf6
|
@ -10,6 +10,7 @@
|
||||||
files: File[] | undefined;
|
files: File[] | undefined;
|
||||||
onupload?: () => void;
|
onupload?: () => void;
|
||||||
isMobile: boolean;
|
isMobile: boolean;
|
||||||
|
acceptedFormats?: string[];
|
||||||
}
|
}
|
||||||
|
|
||||||
$effect(() => {
|
$effect(() => {
|
||||||
|
@ -20,7 +21,7 @@
|
||||||
let fileInput = $state<HTMLInputElement>();
|
let fileInput = $state<HTMLInputElement>();
|
||||||
let dragOver = $state(false);
|
let dragOver = $state(false);
|
||||||
|
|
||||||
let { files = $bindable(), onupload, isMobile }: Props = $props();
|
let { files = $bindable(), onupload, isMobile, acceptedFormats }: Props = $props();
|
||||||
|
|
||||||
function upload() {
|
function upload() {
|
||||||
if (!fileInput) return;
|
if (!fileInput) return;
|
||||||
|
@ -108,6 +109,7 @@
|
||||||
class="hidden"
|
class="hidden"
|
||||||
bind:this={fileInput}
|
bind:this={fileInput}
|
||||||
onchange={addFiles}
|
onchange={addFiles}
|
||||||
|
accept={acceptedFormats?.join(",") ?? "*"}
|
||||||
multiple
|
multiple
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
|
|
@ -77,6 +77,7 @@
|
||||||
isMobile={data.isMobile}
|
isMobile={data.isMobile}
|
||||||
bind:files={ourFiles}
|
bind:files={ourFiles}
|
||||||
onupload={runUpload}
|
onupload={runUpload}
|
||||||
|
acceptedFormats={converters.flatMap((c) => c.supportedFormats)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue