fix(super-editor): declare full namespace set on freshly-created numbering.xml#3792
Open
MIt9 wants to merge 1 commit into
Open
fix(super-editor): declare full namespace set on freshly-created numbering.xml#3792MIt9 wants to merge 1 commit into
MIt9 wants to merge 1 commit into
Conversation
…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>
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.
Summary
word/numbering.xml, then adding the first numbered list, produced a numbering part missingxmlns:w16cid(and otherw16*namespaces). Word refused to open/repair the exported file.numbering-part-descriptor.ts'sensurePart()hand-maintained a 3-key namespace map (xmlns:w/w15/mc) instead of reusingDEFAULT_DOCX_DEFS, the full namespace +mc:Ignorablemap thatdocument.xml,comments.xml,footnotes.xml, andpeople.xmlalready apply unconditionally on every export.ensurePart()(mutateNumbering→mutatePart→executeMutate), so the legacySuperConverter#exportNumberingFilebaseNumberingfallback (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.DEFAULT_DOCX_DEFSforNUMBERING_ROOT_ATTRSinstead of hand-picking namespaces one bug report at a time.Test plan
numberingPartDescriptor.ensurePart()assertingxmlns:w16cid/w14/rare present.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:w16cid→undefined) and passes with it.templates-adapter.integration.test.tsassertion that hardcoded the old narrowmc:Ignorablemerge result ("w15 w14 w16cid") to the same flexible pattern the siblingstyles.xmltest in the same file already uses — the merged value is now a superset (still containsw16cid), not a regression.@superdoc/super-editortest suite: 1215 files / 17165 tests passed.pnpm check:types(repo-widetsc -b): clean.🤖 Generated with Claude Code