Skip to content
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

Fix featured image modal #17410

Conversation

@anthonyburchell
Copy link
Contributor

commented Sep 11, 2019

Description

This is to match the backbone featured image frames expected in the editor. This allows a user to select images with filters of mine and uploaded to post which was previously missing in the existing Gutenberg featured image frame.

How has this been tested?

Much of the discussion that lead to this pull request can be referenced here: #10810

Screen Shot 2019-09-11 at 6 29 51 PM

Issue this fixes:
#8748

@anthonyburchell anthonyburchell requested a review from talldan as a code owner Sep 11, 2019
@@ -79,6 +108,7 @@ class MediaUpload extends Component {
constructor( {
allowedTypes,
gallery = false,
unstableFeaturedImageFlow = false,

This comment has been minimized.

Copy link
@joemcgill

joemcgill Sep 12, 2019

Contributor

This is outside of the scope of this ticket, but I still think it would be nice to consolidate the gallery and featuredImageFlow into a single property that is responsible for determining the library flow (i.e. Frame) that is being loaded.

This comment has been minimized.

Copy link
@joemcgill

joemcgill Sep 13, 2019

Contributor

#1979 is the related issue where I originally suggested the approach of consolidating different flows into a single prop.

@@ -111,6 +141,22 @@ class MediaUpload extends Component {
this.frame.$el.addClass( modalClass );
}

if ( unstableFeaturedImageFlow ) {
const featuredImageFrame = getFeaturedImageMediaFrame();

This comment has been minimized.

Copy link
@jorgefilipecosta

jorgefilipecosta Sep 12, 2019

Member

Would it make sense to put this code inside a function buildAndSetFeatureImageFrame as we do for the gallery frame?

This comment has been minimized.

Copy link
@anthonyburchell

anthonyburchell Sep 13, 2019

Author Contributor

It definitely would. Will do that and update the PR.

* @return {void}
*/
createStates: function createStates() {
this.on( 'toolbar:create:featured-image', this.featuredImageToolbar, this );

This comment has been minimized.

Copy link
@jorgefilipecosta

jorgefilipecosta Sep 12, 2019

Member

This event is essentially used to change the select image button label right?
Can't we use the frame config button prop to achieve something similar?
https://github.com/WordPress/gutenberg//blob/6ed195614f24acdbf626c099b22709d30d5a4d7b/packages/media-utils/src/components/media-upload/index.js#L128-130?

This comment has been minimized.

Copy link
@anthonyburchell

anthonyburchell Sep 13, 2019

Author Contributor

This allows for the button to render. With the Featured Image frame in Core, we have to fire a function similar to this to allow there to be a button. Without this event, there would be an absent select button in the media modal. Here's where we have it in Core: https://github.com/WordPress/wordpress-develop/blob/master/src/js/media/views/frame/post.js#L558-L563

@jorgefilipecosta jorgefilipecosta force-pushed the anthonyburchell:fix/featured-image-modal-8748 branch from 6ed1956 to e701b75 Sep 14, 2019
Copy link
Member

left a comment

Hi @anthonyburchell, there was only a simple change pending I applied and I think we can merge this PR now.
Thank you for this improvement 👍

@jorgefilipecosta jorgefilipecosta changed the title Fix/featured image modal #8748 Fix featured image modal Sep 14, 2019
@jorgefilipecosta jorgefilipecosta merged commit e62a670 into WordPress:master Sep 14, 2019
4 of 7 checks passed
4 of 7 checks passed
pull-request-automation
Details
Header rules - gutenberg-playground No header rules processed
Details
Pages changed - gutenberg-playground 3 new files uploaded
Details
Redirect rules - gutenberg-playground No redirect rules processed
Details
Mixed content - gutenberg-playground No mixed content detected
Details
Travis CI - Pull Request Build Passed
Details
netlify/gutenberg-playground/deploy-preview Deploy preview ready!
Details
@youknowriad youknowriad added this to the Gutenberg 6.5 milestone Sep 14, 2019
dd32 pushed a commit to dd32/gutenberg that referenced this pull request Sep 27, 2019
This is to match the backbone featured image frames expected in the editor. This allows a user to select images with filters of mine and uploaded to post which was previously missing in the existing Gutenberg featured image frame.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.