Standardize on children value as array (step 1)#689
Closed
aduth wants to merge 3 commits into
Closed
Conversation
Same value type as we assume from children() matcher
This was referenced May 5, 2017
youknowriad
approved these changes
May 11, 2017
Contributor
youknowriad
left a comment
There was a problem hiding this comment.
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.
Member
Author
|
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:
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
childrenmatcher 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.childrenproperty 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.