Skip to content

fix(super-converter): normalize inline nodes in non-TOC docPartObj content (SD-2357)#2573

Merged
caio-pizzol merged 2 commits intomainfrom
caio/sd-2357-bug-invalid-content-for-documentpartobject
Mar 26, 2026
Merged

fix(super-converter): normalize inline nodes in non-TOC docPartObj content (SD-2357)#2573
caio-pizzol merged 2 commits intomainfrom
caio/sd-2357-bug-invalid-content-for-documentpartobject

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Documents with non-TOC docPartObj SDTs (page numbers, bibliographies, cover pages) containing top-level inline nodes (bookmarkStart/bookmarkEnd, commentRangeStart/commentRangeEnd, permStart/permEnd) failed to load with Invalid content for node type documentPartObject.

  • Add missing normalizeDocPartContent() call in genericDocPartHandler — the TOC handler already had this, but the generic path was missing it
  • Expand the inline node type set to include commentRangeStart, commentRangeEnd, permStart, permEnd (previously only bookmarkStart/bookmarkEnd were handled)
  • Add unit tests for generic handler normalization and all inline node types

Closes SD-2357

…ntent

The generic docPartObj handler was missing the normalizeDocPartContent()
call that the TOC handler already had, causing documents with non-TOC
gallery types (page numbers, bibliographies, cover pages) containing
top-level inline nodes (bookmarks, comments, permissions) to fail with
"Invalid content for node type documentPartObject".

Also expanded the inline node type set to include commentRangeStart,
commentRangeEnd, permStart, and permEnd.

SD-2357
@linear
Copy link
Copy Markdown

linear Bot commented Mar 26, 2026

@github-actions
Copy link
Copy Markdown
Contributor

Status: PASS

The PR looks clean from an OOXML spec perspective.

commentRangeStart / commentRangeEnd (§17.13.4.4, §17.13.4.3): These are cross-structure annotations that can appear both inside w:p (inline) and between block elements at the body level. Treating them as inline nodes that need wrapping when found at the sdtContent top level is a valid ProseMirror normalization — not a spec violation. The id attribute (required, ST_DecimalNumber) is correctly represented in the tests.

permStart / permEnd (§17.13.7.2, §17.13.7.1): Same story — cross-structure annotations per §17.13.2, so they can legitimately appear inside or between paragraphs. One nuance: permStart.id and permEnd.id are typed as ST_String (not ST_DecimalNumber like comments/bookmarks), but the tests use string '1' for both, so that's fine. The w:edGrp/w:ed attributes on permStart are optional, so the minimal { id: '1' } in tests is conformant.

bookmarkStart / bookmarkEnd: Pre-existing in the set, valid cross-structure annotations.

docPartGallery / docPartObj (§17.5.2.11, §17.5.2.13): No changes to how these are read — the PR only affects what happens to the translated content after the fact.

The normalization logic (wrapping bare cross-structure annotation nodes in a synthetic paragraph) is a ProseMirror schema requirement, not an OOXML round-trip concern, so no spec compliance issue there.

@caio-pizzol caio-pizzol merged commit fd1580e into main Mar 26, 2026
44 of 45 checks passed
@caio-pizzol caio-pizzol self-assigned this Mar 26, 2026
@caio-pizzol caio-pizzol deleted the caio/sd-2357-bug-invalid-content-for-documentpartobject branch March 26, 2026 14:38
@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 26, 2026

🎉 This PR is included in vscode-ext v1.1.0-next.18

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 26, 2026

🎉 This PR is included in superdoc v1.24.0-next.17

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 26, 2026

🎉 This PR is included in superdoc-cli v0.5.0-next.17

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 26, 2026

🎉 This PR is included in superdoc-sdk v1.3.0-next.17

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in esign v2.2.0-next.3

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in template-builder v1.3.0-next.2

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 30, 2026

🎉 This PR is included in superdoc v1.24.0

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Mar 31, 2026

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

The release is available on GitHub release

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

🎉 This PR is included in superdoc-sdk v1.3.0

@superdoc-bot
Copy link
Copy Markdown
Contributor

superdoc-bot Bot commented Apr 2, 2026

🎉 This PR is included in vscode-ext v2.2.0

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.

Error: Failed to open document: Failed to load document: Invalid content for node type documentPartObject

1 participant