Writing flow: merge into nested list item on Delete/Backspace (#77245)#78675
Draft
ellatrix wants to merge 3 commits into
Draft
Writing flow: merge into nested list item on Delete/Backspace (#77245)#78675ellatrix wants to merge 3 commits into
ellatrix wants to merge 3 commits into
Conversation
Fixes the silent bail when pressing Delete at the end of a deeply-nested list item (or Backspace at the start of the block that follows), and brings the merge result closer to normal text-editor behavior: the following block's content concatenates into the innermost list item. - list-item: add `from: [paragraph, heading]` transforms so a list-item can absorb paragraph/heading content via the standard merge path. - block-editor / mergeBlocks: when called on an `__experimentalOnMerge` container with real nesting past the immediate child, drill to the deepest mergeable leaf on each side and merge there; clean up the drilled-out container if it ends up empty. Flat containers keep their historical "absorb as new inner block" behavior. - list-item useMerge: walk past the outermost list when there is no next list item in the tree, and hand off to mergeBlocks so the drilling can land the absorbed content at the innermost level. - Add e2e tests for #77245 covering Delete and Backspace in both the paragraph and sibling-list cases. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Size Change: +261 B (0%) Total Size: 8.18 MB 📦 View Changed
ℹ️ View Unchanged
|
The unit tests in `packages/block-editor/src/store/test/actions.js` exercise `mergeBlocks` with a hand-rolled `select` that only exposes the methods the function historically needed. The drill helpers now guard against missing `getBlockName`/`getBlockOrder`, and the post- merge cleanup batch falls back to a no-op `batch` when `registry` is not provided. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Reverts the previous defensive guards in `mergeBlocks` and instead expands the test stubs to match what the action now uses: - Add a `makeSelect` helper inside the `mergeBlocks` describe that bundles `getBlock` / `getBlockName` / `getBlockOrder` / `getBlockEditingMode` / `isBlockSelected` over the test blocks. - Pass a real `registry` (via `createRegistry()`) so `registry.batch` works the same way it does in the live editor — matching the pattern already used elsewhere in this file (e.g. `replaceBlock` tests). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
No description provided.