-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update BlockPreview component to accept multiple Blocks to preview (#…
…16033) * export BlockPreview * Update to accept multiple Blocks * Update reusable Blocks preview to use the new single blocks prop * Remove unecessary clone of Blocks Not sure why this was introduced. * Remove export. This is being handled in another PR See #16801 * Simplify casting to array via lodash * Utilise cloneBlocks to safely merge attributes on blocks prop * Spread reusable block initial attrs correctly * Fix cloneBlock fn to check for innerBlocks before attempting to map The `innerBlocks` of the `block` being cloned can be `undefined`. Therefore, by attempting to map these we trigger an error. Fixed to introduce existence check before attempting to manipulate innerBlocks. * Simplify modifying passed block attrs via cloneBlock * Removes unecessary spread operation initalAttributes is already an object so no need to spread into an object. * block-preview: ensuring to cast BlockEditorProvider value prop as an Array * don't call cloneBlock on a non-block object * bring back the old behavior of cloneBlock
- Loading branch information
1 parent
4bd6146
commit db484b3
Showing
4 changed files
with
22 additions
and
19 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
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