fix: faulty TOC import/export (SD-2183)#2371
Conversation
|
Status: PASS The OOXML elements and attributes in this PR are all spec-compliant. Here's what I checked:
One minor note:
|
caio-pizzol
left a comment
There was a problem hiding this comment.
@luccas-harbour nice fix — splitting runs with multiple field markers and pulling TOC blocks out of wrapper paragraphs handles the corruption well.
one edge case to be aware of in the field splitter, and one spot where we should copy instead of modify in place — left inline comments on both.
on tests: the existing visual/layout test data covers general TOC and fldChar rendering, but nothing exercises the specific case this PR fixes (all field markers in one run). two unit tests worth adding: one where a single paragraph has both regular content and a TOC element, and one that checks the schema accepts a TOC with no children. a behavior test importing a doc with single-run fldChar fields would also be a nice regression guard but not blocking.
packages/super-editor/src/core/super-converter/field-references/preProcessNodesForFldChar.js
Show resolved
Hide resolved
...per-editor/src/core/super-converter/v3/handlers/w/sdt/helpers/translate-document-part-obj.js
Outdated
Show resolved
Hide resolved
|
🎉 This PR is included in superdoc-cli v0.2.0-next.131 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.18.0-next.56 The release is available on GitHub release |
Summary
Fixes the DOCX export/import issues behind SD-2183 for table of contents content controls.
This PR addresses two related problems:
What Changed
1. Prevent empty SDT IDs during export
2. Handle complex fields stored in a single run
3. Preserve TOC structure inside document part objects
Why
Word expects the TOC field to round-trip as a real complex field sequence. Without that, exported files can lose the TOC field markers and fail to behave correctly when reopened in Word.