Conversation
When a container drops below `min`, `fixContainer` rebuilt it from its surviving child with `tr.replaceWith`, so a caret inside that child collapsed out of it. `fixColumnList` used a `ReplaceAroundStep` here before the rewrite; this restores it for the single-survivor case, which is the only one any container in the repo can reach. Also covers the column layout edges that used to throw out of the keydown handler and had no tests. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@blocknote/ariakit
@blocknote/code-block
@blocknote/core
@blocknote/diagram-block
@blocknote/mantine
@blocknote/math-block
@blocknote/react
@blocknote/server-util
@blocknote/shadcn
@blocknote/xl-ai
@blocknote/xl-docx-exporter
@blocknote/xl-email-exporter
@blocknote/xl-multi-column
@blocknote/xl-odt-exporter
@blocknote/xl-pdf-exporter
@blocknote/xl-typst-exporter
commit: |
|
nperez0111
left a comment
There was a problem hiding this comment.
Yep, that's cleaner in terms of ops
Builds on #3059.
The fix
When a container drops below
min,fixContainerrebuilt it from its surviving child withtr.replaceWith— a delete plus an insert, so a caret inside that child collapsed out of it and landed in a different block entirely.fixColumnListused aReplaceAroundStephere before the rewrite, so this is restoring prior behaviour rather than new work. The step leaves the surviving content untouched in the document, so positions inside it map through.It covers the single-survivor case, which is the only one any container in the repo can reach (
columnListand every fixture aremin: 2). Several survivors are not one contiguous range once an emptied child sits between them, so that path still rebuilds; it takes aminof 3 or more to reach and is noted in a comment.Tests
pair, one level;grid/gridCell, two) and one for the real column case inremoveBlocks. All three fail without the fix, with the caret landing in the wrong block.main(Attempted to get blockContainer node at position 23,RangeError: Position 7 out of range) and passes here. They assert invariants — no throw, valid document, no text lost — so they read the same on both branches.Verified behaviour-neutral for columns: a differential over 14,800 sculpted
columnListstates (2–4 columns × 5 per-column shapes × 4 surroundings × caret in each column) comparing document, selection, validity and throw behaviour againstmain'sfixColumnListshows 0 differences. Without the fix the same matrix shows 248.🤖 Generated with Claude Code