fix: getCellSelection throwing error (BLO-1193)#2911
Conversation
…lock but outside cell
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughTable handle selection now validates resolved positions against actual table cell nodes, preventing invalid gap-cursor positions from reaching document resolution. Tests cover positions beside leading tables, nested blocks, and valid selections inside table cells. ChangesTable cell selection validation
Estimated code review effort: 3 (Moderate) | ~20 minutes Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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/mantine
@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
commit: |
|
Summary
TableHandlesExtension.getCellSelectionthrows an error when the selection is within a table block but not actually a cell selection. For example, the selection can be a gap cursor at the start of the table.In the static formatting toolbar example, the text alignment buttons call
getCellSelectionon selection change. In this example, if a table is at the start of the document, you can move the selection to a gap cursor above the table using the up arrow key or clicking in certain places to the side of the table. The text alignment buttons callgetCellSelectionwhich errors.Closes #2748
Rationale
This is an uncommon error, but one that should be fixed either way.
Changes
Impact
N/A
Testing
Added unit tests.
Screenshots/Video
N/A
Checklist
Additional Notes
It seems strange that a button in the formatting toolbar should even need the table handles extension, so we may want to fix this also.
Summary by CodeRabbit
Bug Fixes
Tests