fix: filter synthetic tracked-change comments on export#3744
fix: filter synthetic tracked-change comments on export#3744caio-pizzol wants to merge 2 commits into
Conversation
…on export exportToDocx excluded every comment flagged trackedChange:true from comments.xml and dropped its commentRange/commentReference anchors. That flag is set both on SuperDoc's synthetic tracked-change projection rows and on genuine user comments anchored to (or overlapping) a tracked change, so real comments placed on a redline were silently lost on export while plain comments survived. Narrow the filter to exclude only synthetic projection rows (trackedChange + no authored body + no parentCommentId) via a new isSyntheticTrackedChangeComment, mirroring isSyntheticTrackedChangeProjection. Genuine comments stay in the export list and the body translator re-emits their anchors. Adds unit coverage in commentsExporter.test.js. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@dheerajiiitv FYI |
|
I attempted to verify against the live ECMA-376 spec tools but permission was denied in this session, so the checks below are against ECMA-376 (§17.13.4 comments) and the documented Microsoft Status: PASS This PR is almost entirely export/filtering logic (deciding which comment rows reach the comment parts and threading them), not new element/attribute emission. Every OOXML construct it touches checks out:
One pre-existing, non-blocking note (not introduced by this PR): the No non-existent elements/attributes, no missing required attributes, no wrong defaults, no spec violations in the changed code. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 49867e7f31
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| collectCommentTextFragments(record.commentText, fragments); | ||
| collectCommentTextFragments(record.commentJSON, fragments); | ||
| collectCommentTextFragments(record.elements, fragments); | ||
| collectCommentTextFragments(record.text, fragments); | ||
|
|
||
| return fragments.join('').trim().length > 0; |
There was a problem hiding this comment.
Ignore empty rich-text shells when filtering synthetic comments
For pre-marker synthetic tracked-change rows (for example, existing collaboration state created before isSyntheticTrackedChangeProjection was added), commentText can be the editor's empty rich-text value '<p></p>'—the UI explicitly treats that as no content in CommentDialog.vue. Counting that raw HTML string as meaningful here makes isSyntheticTrackedChangeComment keep the row, so DOCX export can still emit the automatic tracked-change sidebar entry into comments.xml even though it has no authored body. Consider stripping/parsing HTML empties (at least '<p></p>') before treating commentText/text as authored content.
Useful? React with 👍 / 👎.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Any updated? |
|
@caio-pizzol When are we planning to merge it? |
Summary
Fixes DOCX export for comments that overlap tracked changes by separating real authored comments from automatic tracked-change sidebar rows.
Based on #3741. The original PR commit is retained in this branch history.
Why
The first approach had the right goal, but it checked the export record shape after comments were already normalized. That could still write automatic tracked-change rows into Word comment files.
What changed
Validation
Unit tests were not run locally per project guidance.