fix(editor): migrate autoformat-kit to PlateJS v53 inputRules API#175
fix(editor): migrate autoformat-kit to PlateJS v53 inputRules API#175ryota-murakami merged 2 commits intomainfrom
Conversation
PlateJS v53 removed the pre-built rule arrays (autoformatSmartQuotes,
autoformatPunctuation, autoformatLegal, autoformatLegalHtml,
autoformatArrow, autoformatMath) and deprecated AutoformatPlugin.
The new pattern is plugin-owned inputRules registered via
createSlatePlugin({ inputRules: [...] }).
Replace v52 mark/block/list rules with v53 Rules.markdown() factories
from @platejs/basic-nodes, @platejs/code-block, @platejs/list. Preserve
the v52 codeBlock-disable behavior using the v53 enabled callback.
Text substitution rules (smart quotes, arrows, math, legal) are
intentionally omitted from this migration and tracked separately.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThe autoformat plugin configuration was refactored to use Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 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 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. Review rate limit: 0/1 reviews remaining, refill in 21 minutes and 36 seconds.Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #175 +/- ##
==========================================
+ Coverage 70.16% 70.37% +0.20%
==========================================
Files 161 161
Lines 4659 4641 -18
Branches 1228 1227 -1
==========================================
- Hits 3269 3266 -3
+ Misses 1371 1356 -15
Partials 19 19 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
🧪 E2E Coverage Report (Sharded: 12 parallel jobs)
📊 Full report available in workflow artifacts |
…toformat
HeadingRules.markdown() resolves the markdown prefix (#, ##, ...)
from pluginKey via /^h([1-6])$/. When attached to a standalone
aggregator plugin (key: 'markdownShortcuts') the regex never matches,
so '# ' input never converted to <h1> in v53.
Attach HeadingRules.markdown({ enabled: isNotInCodeBlock }) directly
to each H1Plugin..H6Plugin so pluginKey === 'h1'..'h6' and prefix
resolves correctly.
Fixes E2E shard 9/12 failure: should support markdown autoformat for heading
|
@coderabbitai full review |
✅ Actions performedFull review triggered. |
Reflects the v52→v53 migration completed in PR #175.
Summary
pnpm installpulled in@platejs/* v53.0.0(commit 6623b40). Build/Test/TypeCheck/Vercel/all 12 E2E shards were failing because v53 removed the pre-built rule arrays (autoformatSmartQuotes,autoformatPunctuation,autoformatLegal,autoformatLegalHtml,autoformatArrow,autoformatMath) and deprecatedAutoformatPlugin.src/components/editor/plugins/autoformat-kit.tsxto the v53 plugin-ownedinputRulespattern usingcreateSlatePlugin({ key: 'markdownShortcuts', inputRules: [...] })plus the newRules.markdown()factories from@platejs/basic-nodes,@platejs/code-block, and@platejs/list.enabledcallback.Notes
createTextSubstitutionInputRulewith custom patterns and are tracked separately as a follow-up. They are not blocking CI.@platejs/*import insrc/needed migration (verified by grep + typecheck). The blast radius was 1 file.key: 'autoformat'for the new plugin because v53 throwsAutoformatPlugin cannot be used with plugin-owned input ruleswhen both coexist. UsedmarkdownShortcutsinstead.Test plan
pnpm typecheck— exit 0pnpm lint— exit 0pnpm vitest run— 91 files, 1295 tests passedpnpm build— 15 routes built**bold**,# heading,- list,[] todomarkdown shortcuts trigger correctly in the editorSummary by CodeRabbit