-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Standardize on children value as array (step 1) #689
Conversation
Same value type as we assume from children() matcher
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.
Oh sorry I missed this PR!
This is testing well for me. When I see this PR, I wonder why we needed the concatChildren
in the first place.
This needs a bit of rebase work, and I'm discovering some problems that are also present in master, particularly around initializing new text blocks with string members, then assuming content as guaranteed to be an array of elements. In master, try:
https://github.com/WordPress/gutenberg/blob/ca6bd50/blocks/library/heading/index.js#L69 As a solution, I'm leaning toward one of:
|
Supersedes #640
Blocked by ellatrix/dom-react#1Blocked by #686Partial resolution of #688
This pull request is a step toward treating any attribute which is derived using the
children
matcher as guaranteed to be an array. Subsequent pull requests will expand upon this to provide default values for existing blocks and eliminate truthy tests on these values in favor of length tests only (see: #684).Implementation notes:
I'd hoped to use this opportunity to remove the
props.children
property access I'd lamented about in #667, but unfortunately we can't easily structure the text block as an array of paragraphs, since we need to preserve the text alignment style assigned to the paragraph itself. So for now this remains, but I left some of the general refactoring of the heading "transform from text" I'd explored in the process.Testing instructions:
Verify that there are no regressions in merging a text block into a heading block.
Verify that there are no regressions in merging two of the same text or heading blocks.
Verify that there are no regressions in switching types between heading, text, and quote.
* Caveat: Note that these testing instructions may be broken until blockers are resolved.