fix: mirror explicit left/right paragraph alignment for rtl#3235
fix: mirror explicit left/right paragraph alignment for rtl#3235artem-harbour wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e56997752c
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| case 'left': | ||
| return isRtl ? 'right' : 'left'; | ||
| case 'right': | ||
| return isRtl ? 'left' : 'right'; |
There was a problem hiding this comment.
Preserve visual align commands for RTL paragraphs
When an existing RTL paragraph is edited through the TextAlign extension, setTextAlign('left'/'right') stores the requested visual value directly in paragraphProperties.justification (packages/super-editor/src/editors/v1/extensions/text-align/text-align.js:46). On the next render this normalizer now mirrors that PM attr, so clicking Align Left on an RTL paragraph writes left but DomPainter receives right (and vice versa). This makes the editor toolbar/shortcuts inverted for RTL paragraphs unless the command layer is updated to store the mirrored OOXML value or this mirroring is limited to imported OOXML semantics.
Useful? React with 👍 / 👎.
Linear: SD-3093
Fixes RTL paragraph alignment rendering parity with Word in
pm-adapter.What changed
left/rightare mirrored for RTL paragraphs (w:bidicontext).Why
For RTL documents with explicit
w:jcvalues (notablyw:jc="right"), SuperDoc could render alignment opposite to Word. This patch aligns rendering behavior with OOXML/Word semantics.Scope
Render pipeline only (
layout-engine/pm-adapter), no toolbar/editor command changes.