Skip to content

feat(document-api): improve cross block selection and deleting#2391

Open
harbournick wants to merge 5 commits intomainfrom
nick/doc-api-delete
Open

feat(document-api): improve cross block selection and deleting#2391
harbournick wants to merge 5 commits intomainfrom
nick/doc-api-delete

Conversation

@harbournick
Copy link
Collaborator

No description provided.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 18b0715f97

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

*/
function selectionTargetToRange(t: CompiledSelectionTarget): CompiledRangeTarget {
const startPoint = t.normalizedTarget.start;
const blockId = startPoint.kind === 'text' ? startPoint.blockId : '__selection__';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Avoid synthetic blockId in selection rewrite targets

Using "__selection__" for node-edge CompiledSelectionTarget values breaks text.rewrite on collapsed edge selections (for example, inserting at document start via ranges.resolve + replace). In that case style capture can be empty, and the rewrite path falls back to block-based mark capture (resolveMarksForRangetoAbsoluteBlockPos), which cannot resolve this synthetic id and throws TARGET_NOT_FOUND instead of applying the mutation.

Useful? React with 👍 / 👎.

Comment on lines +803 to +805
const planRes = data.resolutions[0] as TextMutationResolution;
if (planRes.target?.blockId !== '__selection__') {
return planRes;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Return absolute ranges for ref-based mutation receipts

buildSelectionResolutionFromOutcome is returning data.resolutions[0] as a TextMutationResolution, but those resolutions are TextStepResolution values with block-relative offsets. For single-segment ref mutations (resolved as range targets), this produces incorrect receipt.resolution.range coordinates and violates the TextMutationResolution contract that the range is absolute document positions.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant