-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Blocks: Support reusable nested blocks (reusable blocks refactor) (#5228
) * Blocks: Avoid dismissing editable controls In nested context, block selection changes from reusable block to the inner block being edited, but we want to keep the UI shown * Block: Move block context provides into BlockEdit * Revert "Blocks: Disable Convert to Reusable for nested blocks" This reverts commit 8872058. * State: Enhance history reducer utils to support ignores * Block List: Hide disabled default block appender e.g. within Disabled component, e.g. within reusable nested block * State: Update reusable blocks as pointers to state blocks * Block List: Inject inner block list creator as function Generate BlockList from block's own utils, which has advantage of: - Not having circular dependency from blocks to editor - Respecting block menu and contextual toolbar props * Typo: saved -> fetched * Typo: preferencially -> preferentially * Explain why dispatching RECEIVE_BLOCKS is necessary * Remove unnecessary getState variable * Update getInserterItems to respect new reusable block data layout Makes `getInserterItems` and `getFrecentInserterItems` respect that reusable blocks now point to a block that is elsewhere in the editor state. This makes reusable blocks again appear in the inserter. * Provide createInnerBlockList context in BlockPreview Allow reusable nested blocks to be previewed in the inserter by having BlockPreview inject a createInnerBlockList function via context. * Fix flash of 'Not found' error message when fetching a reusable block Re-order the FETCH_REUSABLE_BLOCKS effect so that the reusable block is added to the store before it is marked as no longer being fetched. This prevents core/block from briefly flashing the 'Not found' error message in between dispatches. * When converting reusable -> regular, replace the block with a copy Making a copy of the referenced block prevents the regular block from being removed should the reuasble block be later deleted. * Avoid iterating through reusable blocks twice Use _.map to avoid iterating through the reusable blocks twice in `getReusableBlocks`. * Move createInnerBlockList into `editor/utils`
- Loading branch information
Showing
22 changed files
with
704 additions
and
557 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
Oops, something went wrong.