Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix synced pattern editing in write mode and refactor block editing m…
…ode to reducer (#67026) * Add higher order reducer for pattern block editing modes. - Remove the prev. React effect for managing pattern block editing modes - Implement higher order reducer in the block editor store ... it: - Tracks the clientIds of pattern blocks. - Uses the pattern block clientIds to manage block editing modes for pattern blocks and their inner blocks. - Updates both on any actions that change block lists. * Add higher order reducer for block editing modes while section editing * Handle RESET_ZOOM_LEVEL action * Bug fixes * Avoid mutating `state` in new higher order reducers * Try moving synced pattern client ids into a separate reducer * Revert "Try moving synced pattern client ids into a separate reducer" This reverts commit e1d6ca4. It doesn't really work, since reducer won't have access to `state.blocks.tree`. * Try amalgamating the different derived block editing modes * Fixes * Fix synced patterns in write mode, unbound content blocks being editable * Also update derived block editing mode on `REPLACE_INNER_BLOCKS * Fix descending through controlled inner blocks * Fix nested pattern handling - always process synced patterns in the reducer. Add special handling for only adding pattern block itself as content only when not in zoomed out or nav mode * Zoomed out fixes - content should never be editable in zoomed out, even synced pattern overrides or when write mode is active * Docs * Add end to end test * Remove navigation mode selector tests * Fix partial mocking of blocks package * Add test for isContentBlock * Add unit tests * Remove defaultBlockEditingMode concept * Handle patterns that are outside sections in nav mode * Remove comment * Refactor to handle tree subsections * Optimize each individual action * Fixes and refinements * Comments and renamings * Remove test mocking - else test chokes trying to unlock privateApis * Rework reducer unit tests and add more cases * Add more tests * Handle when the SET_HAS_CONTROLLED_INNER_BLOCKS block has been removed from the state * Inline editing mode calculation for individual blocks * Calculate both the regular and nav mode derived block editing modes at the same time * Update getEnabledClientIdsTree dependencies * Fix tests * Update more tests * Enable write mode experiment for e2e pattern overrides block editing mode tests ---- Co-authored-by: talldan <talldanwp@git.wordpress.org> Co-authored-by: youknowriad <youknowriad@git.wordpress.org> Co-authored-by: draganescu <andraganescu@git.wordpress.org> Co-authored-by: aaronrobertshaw <aaronrobertshaw@git.wordpress.org> Co-authored-by: ramonjd <ramonopoly@git.wordpress.org>
- Loading branch information