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

Hide avatar placeholder on Author block when not in use #1074

Merged
merged 10 commits into from Nov 21, 2019

Conversation

AnthonyLedesma
Copy link
Member

Closes #1050

AuthorBlockImagePlaceholder

An issue here is that the child block core/button does not store a prop of isSelected. Reading props by using the following:

const childButton = wp.data.select( 'core/block-editor' ).getBlocksByClientId( clientId )[ 0 ].innerBlocks[ 0 ];

Any ideas on how to conditionally show when the core/button is selected?

Copy link
Member

@jrtashjian jrtashjian left a comment

Choose a reason for hiding this comment

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

Any ideas on how to conditionally show when the core/button is selected?

Look at how I detected innerBlocks being selected in the Food and Drinks block. Button blocks do have an isSelected attribute applied (all blocks should) so this should work for you:

https://github.com/godaddy/coblocks/blob/master/src/blocks/food-and-drinks/edit.js#L224-L233

@AnthonyLedesma
Copy link
Member Author

Here is the updated behavior after implementing the suggested changes.
authorBlockHidePlaceholderImage

@richtabor richtabor added this to the Next Release milestone Nov 20, 2019
@richtabor
Copy link
Contributor

Currently the dropZone is not available unless there's an image already there - or it's selected. Let's make the dropZone available at all times.

@AnthonyLedesma
Copy link
Member Author

@richtabor Made the suggested change. Now dropZone is available at all times. Also added the necessary logic to persist the image when it exists.

@richtabor
Copy link
Contributor

@jrtashjian Mind taking another peek at this one? Thanks!

@jrtashjian jrtashjian merged commit 843b06c into master Nov 21, 2019
@jrtashjian jrtashjian deleted the author-image-visibility branch November 21, 2019 19:50
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.

ISNBAT see the Author block avatar placeholder if I'm not adding an avatar
3 participants