Skip to content

fix(super-editor): declare full namespace set on freshly-created numbering.xml#3792

Open
MIt9 wants to merge 1 commit into
superdoc-dev:mainfrom
MIt9:fix/gh-3773-numbering-w16cid-namespace
Open

fix(super-editor): declare full namespace set on freshly-created numbering.xml#3792
MIt9 wants to merge 1 commit into
superdoc-dev:mainfrom
MIt9:fix/gh-3773-numbering-w16cid-namespace

Conversation

@MIt9

@MIt9 MIt9 commented Jul 3, 2026

Copy link
Copy Markdown

Summary

  • Fixes Adding numbered list to an imported docx causes export to not load in Word #3773 — importing a docx with no word/numbering.xml, then adding the first numbered list, produced a numbering part missing xmlns:w16cid (and other w16* namespaces). Word refused to open/repair the exported file.
  • numbering-part-descriptor.ts's ensurePart() hand-maintained a 3-key namespace map (xmlns:w/w15/mc) instead of reusing DEFAULT_DOCX_DEFS, the full namespace + mc:Ignorable map that document.xml, comments.xml, footnotes.xml, and people.xml already apply unconditionally on every export.
  • Every numbering-part creation goes through this ensurePart() (mutateNumberingmutatePartexecuteMutate), so the legacy SuperConverter#exportNumberingFile baseNumbering fallback (which does have the full namespace set) never runs for this path — the part descriptor's own map has to be complete on its own.
  • Fix: reuse DEFAULT_DOCX_DEFS for NUMBERING_ROOT_ATTRS instead of hand-picking namespaces one bug report at a time.

Test plan

  • New unit test on numberingPartDescriptor.ensurePart() asserting xmlns:w16cid/w14/r are present.
  • New end-to-end regression test: import blank-doc.docx (no numbering.xml) → toggleOrderedList() → export → assert the exported <w:numbering> root is namespace-complete. Verified this test fails without the fix (xmlns:w16cidundefined) and passes with it.
  • Relaxed one templates-adapter.integration.test.ts assertion that hardcoded the old narrow mc:Ignorable merge result ("w15 w14 w16cid") to the same flexible pattern the sibling styles.xml test in the same file already uses — the merged value is now a superset (still contains w16cid), not a regression.
  • Full @superdoc/super-editor test suite: 1215 files / 17165 tests passed.
  • pnpm check:types (repo-wide tsc -b): clean.

🤖 Generated with Claude Code

…ering.xml (GH superdoc-dev#3773)

Importing a docx with no word/numbering.xml and then adding the first
numbered list produced a numbering part missing xmlns:w16cid (and other
w16* namespaces), so Word refused to open/repair the exported file.

numbering-part-descriptor.ts's ensurePart() hand-maintained a 3-key
namespace map (xmlns:w/w15/mc) instead of reusing DEFAULT_DOCX_DEFS, the
full namespace + mc:Ignorable map that document.xml, comments.xml,
footnotes.xml, and people.xml already apply unconditionally. Since every
numbering-part creation goes through this ensurePart() (mutateNumbering ->
mutatePart -> executeMutate), the legacy SuperConverter#exportNumberingFile
baseNumbering fallback never runs for this path - the part descriptor's own
map has to be complete on its own.

Reuses DEFAULT_DOCX_DEFS instead of hand-picking namespaces one bug report
at a time. Adds a unit test on ensurePart() and an end-to-end regression
test (import numbering-less blank-doc.docx -> toggleOrderedList -> export
-> assert namespace-complete <w:numbering> root). Relaxes one
templates-adapter.integration.test.ts assertion that hardcoded the old
narrow mc:Ignorable merge result to match the sibling styles.xml test's
existing flexible pattern.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@MIt9 MIt9 requested a review from a team as a code owner July 3, 2026 06:53
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.

Adding numbered list to an imported docx causes export to not load in Word

1 participant