Repository navigation
Conversation
Add the merge-blocks-on-delete change for #135. A single BlocksAPI.merge overloaded for a block or a cross-block range joins neighbouring blocks; Backspace/Delete at boundaries and deletions over cross-block selections map to it from the DOM adapter. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.
An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.
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.
What
Planning only. This PR adds the
merge-blocks-on-deleteOpenSpec change for #135. It contains no code changes.One new API method,
BlocksAPI.merge, with two overloads:merge({ block })merges a block into the block before it. Only neighbouring blocks can be merged, so one block is enough.merge({ index })takes a range that crosses blocks. It removes the content inside the range and the blocks in between, then joins the end block into the start block.{ block, key, offset }).mergenever moves the caret, likesplitandconvert.How merging works:
conversionConfig.export: a key path keeps formatting, a function gives plain text, and with no config the first text input is used. There's no direction and no separate convert step.mergethrows for them. On the keyboard, Backspace or Delete next to such a block removes it.The DOM adapter only maps events to calls:
merge({ index })call, then the insert or split where the blocks joined.merge({ block }).There's no
canMerge, no new tool option, and no change toSelectionAPI,TextAPIor the model.Why
v3 is one contenteditable with cross-block selection, so merging is also needed whenever a deletion crosses a block boundary, not only on Backspace/Delete as in v2. Today none of these cases join anything:
@todo support input merginginBlockToolAdapterat that spot.Notes for reviewers
merge/canMergeplus acanBeMergedoption, a newSelectionAPI.deleteContent, extendingTextAPI.remove, and two-step convert-then-merge on Backspace.undo-group-by-task(docs(openspec): propose undo grouping by browser task #201 / feat(core): group undo steps by browser task #203). That change makes a merge a single undo step and fixes undo of block removal, which currently throws.insertFromPaste, which this change routes throughmerge({ index }).🤖 Generated with Claude Code