fix(core): bind Mod-a to select all the document - #2975
Conversation
BlockNote had no `Mod-a` binding, so select-all was left to the browser's native `contenteditable` handling and ProseMirror had to rebuild a document selection from the DOM selection it produced. That fails when a block puts non-editable content first, which check list items do: the checkbox div sits ahead of the `<p>` holding the block's content. So in a document starting with a check list item, ProseMirror could not map the DOM selection to a valid position and dropped it, leaving the caret in place - Backspace then only edited that one block instead of clearing the document. Now `Mod-a` sets an `AllSelection` itself, which selects every block type reliably and deletes down to a single empty paragraph. Also stops `getNearestBlockPos` warning for the positions at the very start and end of the doc, which is where an `AllSelection` ends.
|
@Asodariyasujal is attempting to deploy a commit to the TypeCell Team on Vercel. A member of the Team first needs to authorize it. |
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus 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 had no
Mod-abinding, so select-all was left to the browser's nativecontenteditablehandling and ProseMirror had to rebuild a document selection from the DOM selection it produced.That fails when a block puts non-editable content first, which check list items do: the checkbox div sits ahead of the
<p>holding the block's content. So in a document starting with a check list item, ProseMirror could not map the DOM selection to a valid position and dropped it, leaving the caret in place - Backspace then only edited that one block instead of clearing the document.Now
Mod-asets anAllSelectionitself, which selects every block type reliably and deletes down to a single empty paragraph.Also stops
getNearestBlockPoswarning for the positions at the very start and end of the doc, which is where anAllSelectionends.Summary
Rationale
Changes
Impact
Testing
Screenshots/Video
Checklist
Additional Notes