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

Update media-text focalPoint conditional rendering. #25968

Conversation

kjohnson
Copy link
Contributor

@kjohnson kjohnson commented Oct 8, 2020

Description

The <FocalPointPicker /> has an explicit dependency of imageFill, but also an implicit dependency of mediaUrl, which may result in an empty <FocalPointPicker /> when imageFill is enabled by default in an <InnerBlock /> template.

This change includes an explicit check for mediaUrl, in addition to imageFill, so that the <FocalPointPicker /> does not render empty.

How has this been tested?

Having a custom block using an <InnerBlock /> template which includes the media-text block with imageFill set to true.

const blockTemplate = [
	[ 'core/media-text', {
		imageFill: true,
	}, [
		[ 'core/heading', {
			placeholder: __( 'Heading', 'give' ),
		} ],
		[ 'core/paragraph', {
			placeholder: __( 'Summary', 'give' ),
		} ],
	] ],
];

Insert the custom block, which will not have an image set.

The focal point setting in the sidebar is not rendered.

Screenshots

Before After

Types of changes

Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.
  • I've included developer documentation if appropriate.
  • I've updated all React Native files affected by any refactorings/renamings in this PR.

The FocalPointPicker has an explicit dependency of imageFill, but also
an implicit dependency of mediaUrl, which may result in an empty
FocalPointPicker when imageFill is enabled by default in an InnerBlock
template. This includes an explicit check for mediaUrl, in addition to
imageFill, so that the FocalPointPicker does not render empty.
@kjohnson kjohnson marked this pull request as ready for review October 8, 2020 22:23
Copy link
Member

@jorgefilipecosta jorgefilipecosta left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@jorgefilipecosta jorgefilipecosta merged commit eea5211 into WordPress:master Nov 30, 2020
@github-actions github-actions bot added this to the Gutenberg 9.6 milestone Nov 30, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants