forked from WordPress/gutenberg
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Block API: Support nesting (InnerBlocks) in unknown block types (Word…
…Press#14443) * Block API: Support nesting in unknown block types When the block parser finds a block of unknown type, it wraps it in a special block (per `getUnregisteredTypeHandlerName`) — by default, this will be a block of type `core/missing`. This new outer block can then offer the user the possibility to extract the wrapped content. This commit updates the parsing logic so that the fallback block is fed the entire tree of content of the unknown block — if it has child blocks — and not just its own surface-level content. For instance, when parsing the following unknown block: ```html <!-- wp:my/unknown --> <p>Begin block that contains a list.</p> <!-- wp:list --> <ul><li>1</li><li>2</li></ul> <!-- /wp:list --> <p>End a block that contains a list.</p> <!-- /wp:my/unknown --> ``` Before, the rescued `originalContent` would have been: ```html <!-- wp:my/unknown --> <p>Begin block that contains a list.</p> <p>End block that contains a list.</p> <!-- /wp:my/unknown --> ``` Now, it would be the entire markup for `my/unknown`. * Add group block in the test template to make sure it works recursively Props Tug
- Loading branch information
Showing
2 changed files
with
174 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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