Skip to content

Commit ece3780

Browse files
committed
Expose inputRef and and add required prop to allow html5 validations
1 parent ff4db8e commit ece3780

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/components/Dropzone.svelte

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
isEvtWithFiles,
99
isIeOrEdge,
1010
isPropagationStopped,
11-
TOO_MANY_FILES_REJECTION
11+
onDocumentDragOver,
12+
TOO_MANY_FILES_REJECTION,
1213
} from "./../utils/index";
1314
import { onMount, onDestroy, createEventDispatcher } from "svelte";
1415
@@ -46,7 +47,7 @@
4647
isDragReject: false,
4748
draggedFiles: [],
4849
acceptedFiles: [],
49-
fileRejections: []
50+
fileRejections: [],
5051
};
5152
5253
let rootRef;
@@ -345,19 +346,21 @@
345346
on:dragenter={composeDragHandler(onDragEnterCb)}
346347
on:dragover={composeDragHandler(onDragOverCb)}
347348
on:dragleave={composeDragHandler(onDragLeaveCb)}
348-
on:drop={composeDragHandler(onDropCb)}>
349+
on:drop={composeDragHandler(onDropCb)}
350+
>
349351
<input
350352
{accept}
351353
{multiple}
352354
{required}
353355
type="file"
354-
name={name}
356+
{name}
355357
autocomplete="off"
356358
tabindex="-1"
357359
on:change={onDropCb}
358360
on:click={onInputElementClick}
359361
bind:this={inputRef}
360-
style="display: none;" />
362+
style="display: none;"
363+
/>
361364
<slot>
362365
<p>Drag 'n' drop some files here, or click to select files</p>
363366
</slot>

0 commit comments

Comments
 (0)