feat: add w:pPrChange translator for paragraph property tracked changes (SD-2417)#2705
Conversation
|
Status: PASS The One minor note: See https://ooxml.dev/spec?q=pPrChange for full spec details. |
33e5e5c to
3e946ec
Compare
This issue was fixed. |
There was a problem hiding this comment.
@luccas-harbour clean structure — sharing the base translators between pPr and pPrChange is a nice call.
one issue: when the original <w:pPr/> inside <w:pPrChange> is empty, it gets lost on round-trip. the decode guard you added works, but the encode side never feeds it — the key gets dropped for empty elements. tested with a Word file — the empty <w:pPr/> disappears after export.
also a minor DX thing and a pre-existing ordering note — details in inline comments.
tests look good. left a few comments.
An empty <w:pPr/> inside <w:pPrChange> means "the paragraph previously had no properties" per the OOXML spec, but the encoder was dropping it: pPrTranslator.encode() returns undefined for an empty pPr, so the paragraphProperties key never landed in the encoded change. On decode, the existing fallback couldn't fire because the key was absent, and the element vanished on export. Fall back to an empty object when the inner encode returns undefined, so the key is always present when a <w:pPr> was in the source XML. The decode path already reconstructs the empty <w:pPr/> from this shape.
CT_PPr requires sectPr to precede pPrChange, but the exporter always appended sectPr as the last child. Before the w:pPrChange translator existed, no export contained both children, so the ordering bug was latent. With pPrChange now round-tripping, paragraphs that carry both a section break and a tracked property change were emitted in an order Word rejects. Insert sectPr before any existing w:pPrChange child; otherwise append as before.
…ked-changes-dropped-on-import
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
…ked-changes-dropped-on-import
- pPrChange-translator: add a round-trip that mixes sectPr with other paragraph properties so a regression dropping either half surfaces. - pPr-translator: add two tests that exercise the pPrChange registration end-to-end through the real pPr translator, guarding against a silent SD-2417 regression if the registration is ever removed.
caio-pizzol
left a comment
There was a problem hiding this comment.
lgtm - round-1 items are all cleanly addressed. pushed 8c07f00 with the two test regression guards i flagged (mixed sectPr + other props, and pPrChange routing through wPPrTranslator); revert if you'd prefer your own take.
|
🎉 This PR is included in vscode-ext v2.3.0-next.41 |
|
🎉 This PR is included in @superdoc-dev/react v1.2.0-next.39 The release is available on GitHub release |
|
🎉 This PR is included in template-builder v1.6.0-next.4 The release is available on GitHub release |
|
🎉 This PR is included in esign v2.3.0-next.41 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-cli v0.8.0-next.4 The release is available on GitHub release |
|
🎉 This PR is included in superdoc v1.28.0-next.4 The release is available on GitHub release |
|
🎉 This PR is included in superdoc-sdk v1.6.0-next.40 |
Summary
w:pPrChangetranslator that encodes/decodes tracked changes on paragraph properties (author, date, id) along with the nestedw:pPrcontaining the previous propertiesw:pPrand in the global handler indexpPr↔pPrChange