-
Notifications
You must be signed in to change notification settings - Fork 35
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
Pattern Directory: Allow container blocks to pass validation if they have child-blocks #85
Conversation
This is technically a valid block, since the paragraph is "customized" with the placeholder & font size
It appears like self-closing blocks wouldn't pass. Not sure if that's intentional. Tested using:
|
Hmmm, I think it's okay to leave. The goal is to make sure we're accepting patterns that are sufficiently customized, "Does it meet some minimum size/length? (At least one block with non-default attributes or content?)" (see #22). If either the group or archive block in your example was customized, that would pass - like either of these: <!-- wp:group {"backgroundColor":"pale-cyan-blue"} -->
<div class="wp-block-group has-pale-cyan-blue-background-color has-background"><!-- wp:archives /--></div>
<!-- /wp:group --> <!-- wp:group -->
<div class="wp-block-group"><!-- wp:archives {"displayAsDropdown":true,"showPostCounts":true} /--></div>
<!-- /wp:group --> The error message might be the problem. We could update the error message to say "Pattern content should be customized" or something like that— none of these strings should be considered final :) |
Ah fair. I think that would be helpful. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you are ready.....
Fixes #82 — Container blocks were not considered valid, because the content they have in
innerHTML
is technically empty, the actual child block content is ininnerBlocks
. This updates the validation code to check intoinnerBlocks
too, so groups and columns are correctly validated.It also updates how paragraphs are validated - now any empty paragraph is considered "empty", even if the user maybe customized the font or color. A pattern should contain more content than just an empty styled paragraph.
How to test the changes in this Pull Request:
yarn test:php
or ✅ on the actions hereOr copy this content into the block editor (by switching to the code editor)
Group block code
Columns block code