Skip to content

Add RTL/Farsi support for compose and email rendering - #713

Open
hamedf62 wants to merge 3 commits into
bulwarkmail:mainfrom
hamedf62:feat/rtl-farsi-compose-support
Open

Add RTL/Farsi support for compose and email rendering#713
hamedf62 wants to merge 3 commits into
bulwarkmail:mainfrom
hamedf62:feat/rtl-farsi-compose-support

Conversation

@hamedf62

Copy link
Copy Markdown
Contributor

Summary

  • switch the composer to Tiptap v3's built-in text direction support with textDirection: "auto"
  • keep a manual LTR/RTL toolbar toggle with explicit direction icons when RTL editing support is enabled
  • preserve dir attributes in sanitized email HTML and improve plain-text email rendering with dir="auto"
  • remove the redundant custom text-direction extension that caused duplicate extension warnings

Validation

  • npm run typecheck
  • npx eslint components/email/rich-text-editor.tsx components/email/email-viewer.tsx lib/email-sanitization.ts stores/settings-store.ts
  • browser verification of compose and incoming-message RTL/LTR behavior

Notes

  • the repo still has pre-existing ESLint warnings in calendar-related files that are unrelated to this change

hamedf62 added 2 commits July 31, 2026 00:02
…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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 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 custom TextDirection extension.
  • Keep an explicit LTR/RTL toolbar toggle (guarded by the rtlEditingSupport setting) with updated direction icons.
  • Preserve dir attributes in sanitized email HTML and set dir="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.

Comment thread lib/email-sanitization.ts
// 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'],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants