Skip to content

fix: mirror explicit left/right paragraph alignment for rtl#3235

Open
artem-harbour wants to merge 1 commit into
mainfrom
artem/rtl-v8
Open

fix: mirror explicit left/right paragraph alignment for rtl#3235
artem-harbour wants to merge 1 commit into
mainfrom
artem/rtl-v8

Conversation

@artem-harbour
Copy link
Copy Markdown
Contributor

@artem-harbour artem-harbour commented May 11, 2026

Linear: SD-3093

Fixes RTL paragraph alignment rendering parity with Word in pm-adapter.

What changed

  • Updated paragraph alignment normalization so explicit left/right are mirrored for RTL paragraphs (w:bidi context).
  • Added/updated regression tests for RTL alignment mapping and bidi fallback behavior.

Why

For RTL documents with explicit w:jc values (notably w: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.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@linear
Copy link
Copy Markdown

linear Bot commented May 11, 2026

SD-3093

@artem-harbour artem-harbour marked this pull request as ready for review May 11, 2026 18:45
@artem-harbour artem-harbour requested a review from a team as a code owner May 11, 2026 18:45
@artem-harbour artem-harbour requested a review from caio-pizzol May 11, 2026 18:45
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

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

💡 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".

Comment on lines +48 to +51
case 'left':
return isRtl ? 'right' : 'left';
case 'right':
return isRtl ? 'left' : 'right';
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge 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 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants