Conversation
Three follow-ups on the BlockInfo refactor, all behaviour-preserving. `tableContentCaretPos` is no longer exported: both callers checked `contentKind === "table"` themselves and then called it, duplicating the branch `blockEdgePos` already makes. They now ask `blockEdgePos` for the edge, so the table offset lives in one place instead of three. The keyboard shortcuts computed a block's content edges by hand in twelve places (`content.beforePos + 1` / `content.afterPos - 1`) rather than reading `contentStart` / `contentEnd`, which the refactor added for exactly that. Replacing them left `content` unused in five destructures. `getInsertionPos`'s lazy-blockGroup branch says why only a regular block reaches it, so `wrapIn: blockGroup` reads as implied rather than assumed, and why the `hasContent` check is there to narrow the union.
|
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: |
|
Three follow-ups on top of #3051, all behaviour-preserving. Based on that branch, so the diff is just these changes.
1.
tableContentCaretPosno longer escapes the moduleBoth callers in
KeyboardShortcutsExtensioncheckedcontentKind === "table"themselves and then called the table helper — re-making the decisionblockEdgePosalready makes:All three arms are
blockEdgePos, whose non-table path returns exactlycontentStart/contentEnd. Each site is now one call plus thenullcase — content with no caret, i.e. an image — which is the only thing the helper can't decide for you. The+4table offset is back to living in one place instead of three, and the function is module-private again.2. The keyboard shortcuts use
contentStart/contentEndBlockInfogained those fields in #3051 precisely so callers stop writing the arithmetic, but this file still did it by hand in twelve places (content.beforePos + 1,content.afterPos - 1) — every one a "is the caret at the start/end of this block's content?" check.Replacing them turned out to make
contentunused in five of the destructures, so those shrank too:3. A comment on
getInsertionPos's lazy-blockGroupbranchReading
if (!info.children)it isn't obvious why hardcodingwrapIn: blockGroupis safe, or whyhasContentis tested when it can't be false. Both follow from theBlockInfounion — the container arm makeschildrenrequired, so only a regular block reaches that branch, and thehasContenttest is there to narrow the union socontentcan be read. The comment says so.Verification
Behaviour-preserving, checked against both
mainand #3051 with two differential harnesses — identical scenarios run on each branch and the outputs diffed:Plus core 796, multi-column 82, tests 908, type-aware lint clean.
Net −56 / +39 across the two files.
🤖 Generated with Claude Code