Skip to content

Commit

Permalink
[RNMobile] Added auto opening of media upload options to Gallery bloc…
Browse files Browse the repository at this point in the history
…k v2 (#36757)

* Added auto opening of media upload options to Gallery block.

* Added a CHANGELOG entry.

* Fixed lint issues.
  • Loading branch information
jd-alexander authored Nov 24, 2021
1 parent 800d93c commit f68b6ca
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
13 changes: 13 additions & 0 deletions packages/block-library/src/gallery/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ function GalleryEdit( props ) {
[ clientId ]
);

const wasBlockJustInserted = useSelect(
( select ) => {
return select( blockEditorStore ).wasBlockJustInserted(
clientId,
'inserter_menu'
);
},
[ clientId ]
);

const images = useMemo(
() =>
innerBlockImages?.map( ( block ) => ( {
Expand Down Expand Up @@ -437,6 +447,9 @@ function GalleryEdit( props ) {
value={ hasImageIds ? images : {} }
onError={ onUploadError }
notices={ hasImages ? undefined : noticeUI }
autoOpenMediaUpload={
! hasImages && isSelected && wasBlockJustInserted
}
/>
);

Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-editor/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ For each user feature we should also add a importance categorization label to i
## Unreleased
- [*] [Embed block] Included Link in Block Settings [#36099]
- [**] Fix tab titles translation of inserter menu [#36534]
- [*] [Media&Text block] Fix an issue where the text font size would be bigger than expected in some cases [#36570]
- [*] [Media&Text block] Fix an issue where the text font size would be bigger than expected in some cases [#36570]
- [**] [Gallery block] When a gallery block is added, the media options are auto opened for v2 of the Gallery block. [#36757]

## 1.66.0
- [**] [Image block] Add ability to quickly link images to Media Files and Attachment Pages [#34846]
Expand Down

0 comments on commit f68b6ca

Please sign in to comment.