feat: add Unicode quotation mark input rule for quote blocks#2673
feat: add Unicode quotation mark input rule for quote blocks#2673nperez0111 merged 1 commit intomainfrom
Conversation
Add an input rule that triggers quote block conversion when typing a Unicode quotation mark followed by a space, in addition to the existing `> ` shortcut. This covers characters like ", ", «, », etc. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughThe Quote block's input rules configuration gains an additional pattern-matching rule. The new rule detects when users type a Unicode quotation mark character at the start of input followed by a space, automatically converting it to a quote block—mirroring the existing Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
packages/core/src/blocks/Quote/block.ts (1)
87-95: Add a regression test for the Unicode quote input rule.The implementation matches the existing input-rule pattern, but this new Unicode shortcut should have at least one focused test covering a representative character like
«or“to prevent future regressions.🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@packages/core/src/blocks/Quote/block.ts` around lines 87 - 95, Add a focused regression test that exercises the Unicode quote input rule in the Quote block: write a unit test that simulates typing a representative Unicode quote character plus a space (e.g. "« " and/or "“ ") and asserts the input-rule (the object with find: new RegExp(`^\\p{Quotation_Mark}\\s$`, "u") in the Quote block) produces a node of type "quote" with the expected props; place the test alongside the other block input-rule tests, use the same editor/test helpers (applyInputRule or the project’s test editor harness), and include an explicit assertion so future changes to the regex or rule behavior will fail the test if broken.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@packages/core/src/blocks/Quote/block.ts`:
- Around line 87-95: Add a focused regression test that exercises the Unicode
quote input rule in the Quote block: write a unit test that simulates typing a
representative Unicode quote character plus a space (e.g. "« " and/or "“ ") and
asserts the input-rule (the object with find: new
RegExp(`^\\p{Quotation_Mark}\\s$`, "u") in the Quote block) produces a node of
type "quote" with the expected props; place the test alongside the other block
input-rule tests, use the same editor/test helpers (applyInputRule or the
project’s test editor harness), and include an explicit assertion so future
changes to the regex or rule behavior will fail the test if broken.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 615e8ca0-9a3b-4622-9fbf-9286fc248808
📒 Files selected for processing (1)
packages/core/src/blocks/Quote/block.ts
@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
Add an input rule that converts Unicode quotation mark characters (e.g.
",",«,»,„) followed by a space into a quote block, complementing the existing>shortcut.Ref: suitenumerique/docs#1955 (comment)
Rationale
Many keyboard layouts (especially non-US ones) produce Unicode quotation marks by default rather than the ASCII
>character. Users intuitively type a quotation mark followed by a space to start a quote, and this change makes that work by matching any character in the UnicodeQuotation_Markcategory via\p{Quotation_Mark}.Changes
packages/core/src/blocks/Quote/block.tsusing the regex^\p{Quotation_Mark}\s$(with theuflag) to trigger quote block conversion.Impact
No impact on existing functionality — the existing
>input rule is unchanged. This is purely additive.Testing
Checklist
Additional Notes
The
\p{Quotation_Mark}Unicode property covers all quotation mark characters defined by Unicode, including but not limited to:",",",',',«,»,„,‟,‹,›.Summary by CodeRabbit
Release Notes
>shortcut.