fix(super-editor): keep comment range markers around unpaired tracked changes (SD-2528)#3239
fix(super-editor): keep comment range markers around unpaired tracked changes (SD-2528)#3239tupizz wants to merge 1 commit into
Conversation
β¦ tracked changes (SD-2528) mergeConsecutiveTrackedChanges greedily absorbed trailing w:commentRangeEnd and w:r->w:commentReference elements into a w:del/w:ins wrapper even when no same-id wrapper followed to actually merge into. This produced a lopsided structure where w:commentRangeStart sat outside the wrapper but w:commentRangeEnd ended up inside it, breaking comment round-trip on redlined text. Buffer comment markers during the forward scan and only commit them inside the wrapper when a same-id merge actually happens. Otherwise emit them as siblings, matching Word's expected OOXML. SD-1519 merge behavior is unchanged and covered by the new tests.
|
Note: The MCP Status: PASS The PR doesn't change the OOXML vocabulary being emitted β it only adjusts where comment range markers land relative to a tracked-change wrapper. Quick verification against the spec:
The |
Codecov Reportβ All modified and coverable lines are covered by tests. π’ Thoughts on this report? Let us know! |
Summary
When a user comments on redlined text, the exported DOCX put
w:commentRangeStartoutside thew:delwrapper butw:commentRangeEndand thew:commentReferencerun inside it. Re-importing that file separates the comment from the redline (and from itself) instead of restoring a single unified bubble. Customer-reported (Bonterms).Root cause is in
mergeConsecutiveTrackedChanges(translate-paragraph-node.js). The forward scan greedily absorbed every comment marker / comment-reference run it found after aw:ins/w:del, even when no same-id wrapper actually followed to merge with. So a lone tracked change always swallowed its trailing comment markers.Fix: buffer comment markers during the scan and only commit them inside the wrapper when a same-id merge actually happens. Otherwise emit them as siblings.
w:commentRangeStart...w:del...w:commentRangeEnd...w:r/w:commentReferencenow stays as siblings (SD-2528).Test plan
translate-paragraph-node.test.jscover three cases: SD-2528 (single wrapper + trailing comments), SD-1519 (same-id merge absorbs comments), different-id (no merge, comments stay siblings).pnpm --filter super-editor testpasses (1008 files, 12711 tests).