Skip to content

fix: centered image#2762

Merged
harbournick merged 5 commits intomainfrom
artem/centered-image
Apr 16, 2026
Merged

fix: centered image#2762
harbournick merged 5 commits intomainfrom
artem/centered-image

Conversation

@artem-harbour
Copy link
Copy Markdown
Contributor

@artem-harbour artem-harbour commented Apr 9, 2026

Linear: SD-2469

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: aecf9c4a47

ℹ️ 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 thread packages/layout-engine/pm-adapter/src/converters/paragraph.ts
@artem-harbour
Copy link
Copy Markdown
Contributor Author

@harbournick @caio-pizzol - please review and merge.

Copy link
Copy Markdown
Contributor

@caio-pizzol caio-pizzol left a comment

Choose a reason for hiding this comment

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

@artem-harbour fix works for SD-2469. i pushed three small commits on top:

  • indent support — centering now accounts for paragraph indents, matching Word
  • distribute alignmentw:jc="distribute" now centers groups (regular justify stays left), matching Word
  • 7 more unit tests — guards for wrong drawing types, missing wrap, other alignment values, oversized groups

uploaded a 17-case test file to the corpus covering every alignment value + indents + RTL + edge cases. layout and visual tests pick it up automatically.

note: the Codex bot's suggestion to use block.wrap?.type would break the feature — normalizeWrap strips 'Inline' from that field. the current attrs.wrap approach is correct.

all 17 cases verified in dev app against Word.

artem-harbour and others added 4 commits April 16, 2026 11:52
The centering math was using the full column width, ignoring paragraph
indents (w:ind). This meant centered/right-aligned inline wpg groups in
indented paragraphs were offset from where Word places them. Now
propagates paragraphAttrs.indent through the drawing block attrs and
subtracts it from the alignment box in layoutDrawingBlock.
Covers all ST_Jc values (left/justify/distribute produce no offset),
non-shapeGroup drawingKind guard (image/vectorShape/chart), missing and
empty wrap guards, oversized group scaling interaction, right alignment
propagation, and left/justify non-propagation in pm-adapter.
Word distributes remaining space equally around single inline content,
which visually centers a sole inline drawing. normalizeAlignment
collapses 'distribute' to 'justify', so we check the raw justification
value from resolvedParagraphProperties to distinguish it from 'both'
(which only stretches inter-word spacing and does not center).
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Copy link
Copy Markdown
Collaborator

@harbournick harbournick left a comment

Choose a reason for hiding this comment

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

LGTM

@harbournick harbournick enabled auto-merge April 16, 2026 22:14
@harbournick harbournick added this pull request to the merge queue Apr 16, 2026
Merged via the queue into main with commit f866ee0 Apr 16, 2026
52 checks passed
@harbournick harbournick deleted the artem/centered-image branch April 16, 2026 22:22
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in @superdoc-dev/react v1.2.0-next.19

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in vscode-ext v2.3.0-next.22

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in template-builder v1.5.0-next.22

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in esign v2.3.0-next.22

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in superdoc v1.26.0-next.22

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in superdoc-cli v0.7.0-next.23

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 16, 2026

🎉 This PR is included in superdoc-sdk v1.6.0-next.20

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 17, 2026

🎉 This PR is included in superdoc-cli v0.7.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot bot commented Apr 17, 2026

🎉 This PR is included in superdoc v1.27.0

The release is available on GitHub release

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.

6 participants