Skip to content

Commit 26daadf

Browse files
committed
Renames all inputRefs
1 parent ea6ebed commit 26daadf

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,7 @@ yarn add svelte-file-dropzone
6363
| containerClasses | custom container classes | "" |
6464
| containerStyles | custom inline container styles | "" |
6565
| disableDefaultStyles | don't apply default styles to container | false |
66-
| inputElement | reference to inputRef | undefined |
67-
66+
| inputElement | reference to inputElement | undefined |
6867
| required | html5 required attribute added to input | false |
6968

7069
### Events

src/components/Dropzone.svelte

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -61,10 +61,10 @@
6161
6262
// Fn for opening the file dialog programmatically
6363
function openFileDialog() {
64-
if (inputRef) {
65-
inputRef.value = null; // TODO check if null needs to be set
64+
if (inputElement) {
65+
inputElement.value = null; // TODO check if null needs to be set
6666
state.isFileDialogActive = true;
67-
inputRef.click();
67+
inputElement.click();
6868
}
6969
}
7070
@@ -214,7 +214,7 @@
214214
215215
// Files dropped keep input in sync
216216
if (event.dataTransfer) {
217-
inputRef.files = event.dataTransfer?.files;
217+
inputElement.files = event.dataTransfer?.files;
218218
}
219219
220220
state.acceptedFiles = acceptedFiles;
@@ -287,8 +287,8 @@
287287
// Execute the timeout only if the file dialog is opened in the browser
288288
if (state.isFileDialogActive) {
289289
setTimeout(() => {
290-
if (inputRef) {
291-
const { files } = inputRef;
290+
if (inputElement) {
291+
const { files } = inputElement;
292292
293293
if (!files.length) {
294294
state.isFileDialogActive = false;
@@ -301,7 +301,7 @@
301301
302302
onDestroy(() => {
303303
// This is critical for canceling the timeout behaviour on `onWindowFocus()`
304-
inputRef = null;
304+
inputElement = null;
305305
});
306306
307307
function onInputElementClick(event) {
@@ -357,7 +357,7 @@
357357
tabindex="-1"
358358
on:change={onDropCb}
359359
on:click={onInputElementClick}
360-
bind:this={inputRef}
360+
bind:this={inputElement}
361361
style="display: none;"
362362
/>
363363
<slot>

0 commit comments

Comments
 (0)