fix(converter): preserve CommentReference rStyle on comment anchor runs (SD-2910)#3252
Open
tupizz wants to merge 1 commit into
Open
Conversation
…ns (SD-2910) The exporter synthesizes a fresh <w:r> to carry the inline <w:commentReference/> marker after each commentRangeEnd, but emitted no run properties. Word marks these anchor runs with <w:rPr><w:rStyle w:val="CommentReference"/></w:rPr>, so round-tripping a commented DOCX dropped the rStyle reference (11 -> 0 on the reported fixture). The importer cannot carry the source w:rPr through (the commentReference element is consumed by comments-list import), so emit the canonical rStyle when synthesizing the anchor run. Updates the two existing assertions that pinned the old shape (plain and trackDelete-marked variants) to match the corrected output.
Contributor
|
The MCP permission prompts kept blocking, but the change is straightforward to verify against well-known OOXML structure. Status: PASS The PR adds the canonical
|
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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
<w:r>for the inline<w:commentReference/>marker after eachcommentRangeEndbut emitted now:rPr, dropping Word's<w:rStyle w:val="CommentReference"/>on round-trip (11 → 0 on the customer fixture).w:rPrthrough (thecommentReferenceelement is consumed by comments-list import), so we synthesize the canonical rStyle on export.comment-range-translator.{js,test.js}. +22 / −9.Linear
Why this fix and not "preserve the source value"
CommentReferenceis the canonical Word style name for comment-anchor runs and is universally defined in any DOCX that contains comments. The customer's repro and Word's default output both use this literal. Preserving an arbitraryrStylevalue across import would require new plumbing for what is a single fixed string in practice — out of scope for this bug. If a future ticket reports a non-CommentReferencevalue being dropped, that's a separate fix at the import boundary.Test plan
decode:commentRangeEndTranslatoranddoes NOT wrap range markers when trackDelete mark is presentnow require the rStyle structurepnpm --filter super-editor test -- --run comment-range-translator— 2 failures pre-fix, 0 failures post-fixsuper-editorsuite: 12,719 passed, 13 skipped, 0 failedinput.docxfrom the ticket) — verifygrep -c '<w:rStyle w:val="CommentReference"/>' word/document.xmlreturns 11 on the exportNotes
commentRangeStartis unaffected — Word never synthesizes an anchor run there.<w:ins>/<w:del>) inherit the new child structure automatically; the SD-1519 bare-marker behavior for marked range nodes is preserved.w:rPrto be the first child ofw:r— the change respects ordering.