Skip to content

Commit

Permalink
Try: allow multiple attribute to be a string in upload components (#…
Browse files Browse the repository at this point in the history
…53350)

* Update MediaPlaceholder docs to include add

* Update FormFileUpload types to allow strings for multiple prop

* Update FormFIleUpload and MediaUpload readme files

* Revert addition of string type for FormFileUpload

* Revert additional FormFileUpload type comments

* Ensure multiple is boolean

* Ensure multiple is boolean in media placeholder component

* Ensure multiple is a boolean in media replace flow component
  • Loading branch information
mikachan committed Sep 6, 2023
1 parent 97ccdb6 commit 7924ef1
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ An object that can contain a `title` and `instructions` properties. These proper

### multiple

Whether to allow multiple selection of files or not.
Whether to allow multiple selection of files or not. This property will also accept a string with the value `add` to allow multiple selection of files without the need to use the `Shift` or `Ctrl`/`Cmd` keys.

- Type: `Boolean`
- Type: `Boolean|String`
- Required: No
- Default: `false`
- Platform: Web
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -469,7 +469,7 @@ export function MediaPlaceholder( {
<FormFileUpload
onChange={ onUpload }
accept={ accept }
multiple={ multiple }
multiple={ !! multiple }
render={ ( { openFileDialog } ) => {
const content = (
<>
Expand Down Expand Up @@ -508,7 +508,7 @@ export function MediaPlaceholder( {
) }
onChange={ onUpload }
accept={ accept }
multiple={ multiple }
multiple={ !! multiple }
>
{ __( 'Upload' ) }
</FormFileUpload>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ const MediaReplaceFlow = ( {
uploadFiles( event, onClose );
} }
accept={ accept }
multiple={ multiple }
multiple={ !! multiple }
render={ ( { openFileDialog } ) => {
return (
<MenuItem
Expand Down
5 changes: 3 additions & 2 deletions packages/block-editor/src/components/media-upload/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ Value of Frame content default mode like 'browse', 'upload' etc.
- Required: No
- Default: false
- Platform: Web

### multiple

Whether to allow multiple selections or not.
Whether to allow multiple selection of files or not. This property will also accept a string with the value `add` to allow multiple selection of files without the need to use the `Shift` or `Ctrl`/`Cmd` keys.

- Type: `Boolean`
- Type: `Boolean|String`
- Required: No
- Default: false
- Platform: Web
Expand Down

0 comments on commit 7924ef1

Please sign in to comment.