Add RTL support for titles#25
Conversation
|
Warning Review limit reached
Next review available in: 7 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. 📝 WalkthroughWalkthroughText clips now expose ChangesRTL Text Rendering
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant Inspector
participant drawText
participant lineDirections
participant Canvas2D
Inspector->>drawText: provide direction prop
drawText->>lineDirections: compute per-line directions
lineDirections-->>drawText: return RTL or LTR flags
drawText->>Canvas2D: paint direction-aware text
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ 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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
app.js (1)
2647-2662: 🚀 Performance & Scalability | 🔵 Trivial | ⚡ Quick winCache automatic direction detection outside the render loop.
getComputedStylecurrently runs for every line on every frame, forcing repeated style resolution during preview and export. Cache directions by text/direction, invalidating them only when those props change.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app.js` around lines 2647 - 2662, Update the text-direction flow around detectTextDirection and lineDirections to cache automatically detected directions by text and the relevant direction setting, so repeated lines avoid calling getComputedStyle on every render frame. Reuse cached values during lineDirections, and invalidate or refresh the cache only when the text or direction properties change; preserve forced ltr/rtl behavior without probing.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app.js`:
- Around line 2852-2863: The typewriter animation in the anim === "typewriter"
branch currently budgets and slices UTF-16 code units, allowing grapheme
clusters to be split. Update this loop to reuse graphemeSegments() for each
line’s visible prefix and length accounting, so budget advances and displayed
text operate on complete grapheme clusters.
---
Nitpick comments:
In `@app.js`:
- Around line 2647-2662: Update the text-direction flow around
detectTextDirection and lineDirections to cache automatically detected
directions by text and the relevant direction setting, so repeated lines avoid
calling getComputedStyle on every render frame. Reuse cached values during
lineDirections, and invalidate or refresh the cache only when the text or
direction properties change; preserve forced ltr/rtl behavior without probing.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
What does this PR do?
Adds support for RTL scripts in titles. Before, only LRT scripts were supported. Now the direction is auto-discovered (best-effort) and the directional effects (such as clip-reveal) are applied according to the direction discovered. For letter-level effects, like letter-pop word level effects are applied as a fallback. This is especially important for Arabic, Urdu and Indic scripts (or others with contextual shaping if such exist), where splitting words into letters would be difficult without a dedicated text shaper, so it is a reasonable compromise.
Type of change
How was it verified?
node --check server.js && node --check app.js && node --check mcp-server.jspassesCLAUDE.md/README.mdif the schema, props, or API changedChecklist
Summary by CodeRabbit