Repository navigation
fix(docx-io): preserve nested figures and list paragraphs - #5330
Closed
tarasromil wants to merge 2 commits into
Closed
tarasromil wants to merge 2 commits into
tarasromil wants to merge 2 commits into
Conversation
Review or Edit in CodeSandboxOpen the branch in Web Editor • VS Code • Insiders |
🦋 Changeset detectedLatest commit: 93275c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Member
|
This PR does not allow maintainer edits, so my fix is in tarasromil#1, a PR into your branch. Merge it there and this PR picks it up. On top of the PR
Demo
Before After
Before After Verification
|
1 task done
Member
1 task done
zbeyens
added a commit
that referenced
this pull request
Nov 4, 2026
… [skip release] Word export now keeps figures inside table cells and list items, with their captions and their bold and italic. Each block paragraph of a list item is its own paragraph. The first one carries the bullet, and later ones take the item's indent. Images fit the width of their table cell or list item. Inside a list item, line breaks, kbd and inline images stay in the item's paragraph, an image that starts the item sits on its bullet, and the item keeps its number when its figure has nothing to export. Plate's own static image, which sits in its void's div beside a hidden spacer, stays in its list item too. This carries #5330, which does not allow maintainer edits, with review fixes on top. Co-authored-by: Taras Romilovych <tarasromil@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



HTML-to-DOCX export drops images and captions when a figure is nested in a table cell or list item. Multiple block paragraphs in one list item are also merged instead of being preserved as continuations.
For example,
<ul><li><p>Before</p><div><figure><img src="data:image/png;base64,..."><figcaption><strong>Caption</strong></figcaption></figure></div><p>After</p></li></ul>loses the figure. A table cell with a wrapped figure has the same problem.This reuses figure traversal across the document body, table cells and list items. Images retain their paragraph indentation and fit within the available content width, accounting for table cell margins and list indentation, including lists inside cells. Intrinsic and explicit CSS dimensions use the same final width limit while preserving their aspect ratio. Rich captions, block order, nested lists and continuation paragraphs are retained. No new dependencies or public API changes.
Validation on
93275c710a2dc16abd9c4c0d8d504b60625e6a34:pnpm test -- ./packages/docx-io: 107 passed across 17 files.pnpm test:slow -- ./packages/docx-io: 80 passed across 8 files.pnpm --filter @platejs/docx-io lint,typecheck, andbuild: passed.pnpm checkwas not run.AI-assisted with Codex; the diff was reviewed and the affected package was fully tested locally.