-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Transform the accept
prop into a string everywhere
#5380
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lakesare
changed the title
Transform the Aug 1, 2024
/dev/Dashboard.js
- add all restrictions for the development environmentaccept
prop into a string everywhere
Diff output filesdiff --git a/packages/@uppy/dashboard/lib/components/AddFiles.js b/packages/@uppy/dashboard/lib/components/AddFiles.js
index 07770cb..8a0edf9 100644
--- a/packages/@uppy/dashboard/lib/components/AddFiles.js
+++ b/packages/@uppy/dashboard/lib/components/AddFiles.js
@@ -19,6 +19,7 @@ class AddFiles extends Component {
event.target.value = null;
};
this.renderHiddenInput = (isFolder, refCallback) => {
+ var _this$props$allowedFi;
return h("input", {
className: "uppy-Dashboard-input",
hidden: true,
@@ -29,7 +30,9 @@ class AddFiles extends Component {
name: "files[]",
multiple: this.props.maxNumberOfFiles !== 1,
onChange: this.onFileInputChange,
- accept: this.props.allowedFileTypes,
+ accept: (_this$props$allowedFi = this.props.allowedFileTypes) == null
+ ? void 0
+ : _this$props$allowedFi.join(", "),
ref: refCallback,
});
};
diff --git a/packages/@uppy/drag-drop/lib/DragDrop.js b/packages/@uppy/drag-drop/lib/DragDrop.js
index bf02d06..5f2d2c3 100644
--- a/packages/@uppy/drag-drop/lib/DragDrop.js
+++ b/packages/@uppy/drag-drop/lib/DragDrop.js
@@ -101,6 +101,7 @@ export default class DragDrop extends UIPlugin {
this.i18nInit();
}
renderHiddenFileInput() {
+ var _restrictions$allowed;
const {
restrictions,
} = this.uppy.opts;
@@ -113,7 +114,9 @@ export default class DragDrop extends UIPlugin {
},
name: this.opts.inputName,
multiple: restrictions.maxNumberOfFiles !== 1,
- accept: restrictions.allowedFileTypes,
+ accept: (_restrictions$allowed = restrictions.allowedFileTypes) == null
+ ? void 0
+ : _restrictions$allowed.join(", "),
onChange: this.onInputChange,
});
}
diff --git a/packages/@uppy/file-input/lib/FileInput.js b/packages/@uppy/file-input/lib/FileInput.js
index 90b6833..13cfa50 100644
--- a/packages/@uppy/file-input/lib/FileInput.js
+++ b/packages/@uppy/file-input/lib/FileInput.js
@@ -48,6 +48,7 @@ export default class FileInput extends UIPlugin {
this.input.click();
}
render() {
+ var _restrictions$allowed;
const hiddenInputStyle = {
width: "0.1px",
height: "0.1px",
@@ -59,7 +60,6 @@ export default class FileInput extends UIPlugin {
const {
restrictions,
} = this.uppy.opts;
- const accept = restrictions.allowedFileTypes ? restrictions.allowedFileTypes.join(",") : undefined;
return h(
"div",
{
@@ -72,7 +72,9 @@ export default class FileInput extends UIPlugin {
name: this.opts.inputName,
onChange: this.handleInputChange,
multiple: restrictions.maxNumberOfFiles !== 1,
- accept: accept,
+ accept: (_restrictions$allowed = restrictions.allowedFileTypes) == null
+ ? void 0
+ : _restrictions$allowed.join(", "),
ref: input => {
this.input = input;
}, |
lakesare
commented
Aug 1, 2024
// minNumberOfFiles: 1, | ||
// allowedFileTypes: ['image/*', '.jpg', '.jpeg', '.png', '.gif'], | ||
// requiredMetaFields: ['caption'], | ||
// } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This adds all existing restrictions to our dev file - I frequently need those, and I assume others do too
Murderlon
approved these changes
Aug 1, 2024
Merged
github-actions bot
added a commit
that referenced
this pull request
Aug 16, 2024
| Package | Version | Package | Version | | ---------------------- | ------- | ---------------------- | ------- | | @uppy/aws-s3 | 4.0.3 | @uppy/provider-views | 4.0.1 | | @uppy/companion | 5.0.5 | @uppy/status-bar | 4.0.2 | | @uppy/companion-client | 4.0.1 | @uppy/transloadit | 4.0.2 | | @uppy/core | 4.1.1 | @uppy/tus | 4.0.1 | | @uppy/dashboard | 4.0.3 | @uppy/utils | 6.0.2 | | @uppy/drag-drop | 4.0.2 | @uppy/vue | 2.0.1 | | @uppy/file-input | 4.0.1 | uppy | 4.1.1 | | @uppy/image-editor | 3.0.1 | | | - @uppy/transloadit: fix issue with `allowMultipleUploadBatches` (Mikael Finstad / #5400) - meta: Bump elliptic from 6.5.5 to 6.5.7 (dependabot[bot] / #5410) - meta: add back patch for `p-queue` (Antoine du Hamel / #5409) - @uppy/transloadit: fix many lurking `TypeError` (Mikael Finstad / #5399) - docs: improve `corsOrigins` documentation (Mikael Finstad / #5390) - docs: add `ViewEncapsulation` to Angular example (Aaron Russell / #5395) - @uppy/companion: fix code for custom providers (Mikael Finstad / #5398) - docs: add note about throwing in `cancelAll` and `destroy()` (Mikael Finstad / #5408) - meta: Bump docker/login-action from 3.2.0 to 3.3.0 (dependabot[bot] / #5372) - meta: Bump docker/setup-qemu-action from 3.1.0 to 3.2.0 (dependabot[bot] / #5370) - docs: make hosted Companion more clear (Merlijn Vos / #5394) - meta: Bump docker/build-push-action from 6.4.1 to 6.6.1 (dependabot[bot] / #5403) - meta: bump p-queue to latest, remove patch (Mikael Finstad / #5391) - meta: enforce `.ts` extension for relative import types (Antoine du Hamel / #5393) - @uppy/tus: Fix onShouldRetry type signature (Trent Nadeau / #5387) - @uppy/dashboard,@uppy/drag-drop,@uppy/file-input: Transform the `accept` prop into a string everywhere (Evgenia Karunus / #5380) - docs: fix getTemporarySecurityCredentials in aws-s3 (Merlijn Vos / #5363)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR passes a string to
accept
, just like its type wants(property) JSXInternal.HTMLAttributes<HTMLInputElement>.accept?: string | undefined
.Technically,
accept
was already transforming the array into a string - but that was undocumented behaviour.Before
After