Add RTL/Farsi support for compose and email rendering - #713
Open
hamedf62 wants to merge 3 commits into
Open
Conversation
…nability - Reorganized the migration logic for settings to improve readability. - Ensured consistent formatting and indentation throughout the migration function. - Maintained existing functionality while enhancing code structure.
…ose-support # Conflicts: # components/email/email-viewer.tsx
There was a problem hiding this comment.
🟡 Changes recommended
The new sanitizer behavior (dir preservation) should be covered by an explicit unit test to prevent regressions.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.
Pull request overview
Updates the email composer and viewer to better support RTL languages (including Farsi) by relying on Tiptap v3’s built-in direction handling, preserving dir through sanitization, and improving plain-text rendering directionality.
Changes:
- Switch composer direction handling to Tiptap v3 core support (
textDirection: "auto") and remove the customTextDirectionextension. - Keep an explicit LTR/RTL toolbar toggle (guarded by the
rtlEditingSupportsetting) with updated direction icons. - Preserve
dirattributes in sanitized email HTML and setdir="auto"when rendering plain-text messages in the viewer.
File summaries
| File | Description |
|---|---|
stores/settings-store.ts |
Enables RTL editing support by default and reformats the settings migration function. |
lib/email-sanitization.ts |
Whitelists the dir attribute so direction metadata survives sanitization. |
components/email/text-direction.ts |
Removes the now-redundant custom Tiptap text direction extension. |
components/email/rich-text-editor.tsx |
Configures Tiptap’s built-in text direction support and updates the RTL/LTR toolbar toggle UI. |
components/email/email-viewer.tsx |
Improves RTL/LTR behavior for plain-text rendering via dir="auto" and a unicode-bidi rule. |
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Lite
We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.
| // ALLOW_DATA_ATTR:false so the viewer can detect and collapse the quoted | ||
| // original (lib/quote-collapse.ts); it's inert otherwise. | ||
| ADD_ATTR: ['target', 'rel', 'style', 'class', 'width', 'height', 'align', 'valign', 'bgcolor', 'color', 'data-quoted-html'], | ||
| ADD_ATTR: ['target', 'rel', 'style', 'class', 'width', 'height', 'align', 'valign', 'bgcolor', 'color', 'dir', 'data-quoted-html'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
textDirection: "auto"dirattributes in sanitized email HTML and improve plain-text email rendering withdir="auto"Validation
npm run typechecknpx eslint components/email/rich-text-editor.tsx components/email/email-viewer.tsx lib/email-sanitization.ts stores/settings-store.tsNotes