feat(desktop): support RTL direction and alignment for non-LTR texts#35635
feat(desktop): support RTL direction and alignment for non-LTR texts#35635majidasgari wants to merge 1 commit into
Conversation
…n markdown and editor Implement dynamic Right-to-Left (RTL) text direction and right-alignment specifically for the desktop client when rendering or typing RTL scripts (Persian, Arabic, Hebrew, etc.). Why: - In the desktop application, messages and query inputs containing RTL characters currently default to LTR alignment and direction, which highly degrades readability. What: - Guarded all RTL logic behind a `window.api` check (exposed by the Electron preload script) to ensure it only applies within the desktop client wrapper. - Extended the Markdown renderer's `decorate` function in `session-ui` to dynamically apply `direction: rtl` and `text-align: right` on paragraphs (`p`), table cells (`td`, `th`), list items (`li`), and headings (`h1`-`h6`) containing RTL script characters. - Structured Q&A tool component rendering elements in `message-part.tsx` are also properly styled using conditional direction and alignment attributes. - Added a reactive `isRtl` memo inside the composer `PromptInput` component to automatically toggle the input's direction/alignment as soon as the user starts typing in an RTL language. Impact: - Zero side-effects on the web application or browser builds, keeping the web client's behavior and performance untouched.
|
This PR doesn't fully meet our contributing guidelines and PR template. What needs to be fixed:
Please edit this PR description to address the above within 2 hours, or it will be automatically closed. If you believe this was flagged incorrectly, please let a maintainer know. |
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicates FoundPR #32247 - feat(ui): full RTL support for Arabic and RTL languages
PR #32727 - fix(app): auto-detect text direction (RTL) for messages and composer
These PRs likely address similar or overlapping functionality for RTL text support. You may want to review their implementation approach and status to determine if PR #35635 duplicates their work or provides complementary desktop-specific enhancements. |
|
This pull request has been automatically closed because it was not updated to meet our contributing guidelines within the 2-hour window. Feel free to open a new pull request that follows our guidelines. |
feat(desktop): support RTL direction and alignment for non-LTR text in markdown and editor
Implement dynamic Right-to-Left (RTL) text direction and right-alignment specifically for the desktop client when rendering or typing RTL scripts (Persian, Arabic, Hebrew, etc.).
Why:
What:
window.apicheck (exposed by the Electron preload script) to ensure it only applies within the desktop client wrapper.decoratefunction insession-uito dynamically applydirection: rtlandtext-align: righton paragraphs (p), table cells (td,th), list items (li), and headings (h1-h6) containing RTL script characters.message-part.tsxare also properly styled using conditional direction and alignment attributes.isRtlmemo inside the composerPromptInputcomponent to automatically toggle the input's direction/alignment as soon as the user starts typing in an RTL language.Impact:
Issue for this PR
Closes #
Type of change
What does this PR do?
Please provide a description of the issue, the changes you made to fix it, and why they work. It is expected that you understand why your changes work and if you do not understand why at least say as much so a maintainer knows how much to value the PR.
If you paste a large clearly AI generated description here your PR may be IGNORED or CLOSED!
How did you verify your code works?
Screenshots / recordings
If this is a UI change, please include a screenshot or recording.
Checklist
If you do not follow this template your PR will be automatically rejected.