Skip to content

feat(docx-io): add tracked changes and comments import/export#4836

Open
arthrod wants to merge 1 commit intoudecode:mainfrom
arthrod:feat/docx-import-export-suggestions-comments
Open

feat(docx-io): add tracked changes and comments import/export#4836
arthrod wants to merge 1 commit intoudecode:mainfrom
arthrod:feat/docx-import-export-suggestions-comments

Conversation

@arthrod
Copy link

@arthrod arthrod commented Feb 8, 2026

Add full round-trip support for DOCX tracked changes (suggestions) and comments with threading. This enables import/export of Word documents while preserving revision history and comment discussions.

Import pipeline:

  • Custom mammoth.js fork emits [[DOCX_*:...]] tokens for ins/del/comments
  • importTrackChanges.ts parses tokens, applies suggestion marks
  • importComments.ts parses comment tokens, creates discussion structures
  • importDocx.ts orchestrates full pipeline with token cleanup
  • searchRange.ts provides text-based range finding for token placement

Export pipeline:

  • exportTrackChanges.ts injects tracking tokens into serialized HTML
  • exportComments.ts handles comment-specific OOXML generation
  • html-to-docx enhanced with comments.xml, commentsExtended.xml, commentsIds.xml, commentsExtensible.xml, and people.xml generation
  • Proper paraId threading for reply chains

App integration:

  • import-toolbar-button.tsx: full DOCX import with user registration
  • export-toolbar-button.tsx: export with discussions and suggestions
  • suggestion-node-docx.tsx: DOCX-safe suggestion rendering (no ins/del)
  • discussion-kit.tsx: paraId fields for round-trip fidelity
  • docx-export-kit.tsx: SuggestionLeafDocx override for clean export

Key features:

  • Suggestion authorship preserved through round-trip
  • Comment threading via paraId/parentParaId linking
  • UTC date handling for cross-timezone compatibility
  • Overlapping comment ranges supported
  • ImportedUser type for user store registration

Checklist

  • yarn typecheck
  • yarn lint:fix
  • yarn test
  • yarn brl
  • yarn changeset
  • ui changelog

Add full round-trip support for DOCX tracked changes (suggestions) and
comments with threading. This enables import/export of Word documents
while preserving revision history and comment discussions.

Import pipeline:
- Custom mammoth.js fork emits [[DOCX_*:...]] tokens for ins/del/comments
- importTrackChanges.ts parses tokens, applies suggestion marks
- importComments.ts parses comment tokens, creates discussion structures
- importDocx.ts orchestrates full pipeline with token cleanup
- searchRange.ts provides text-based range finding for token placement

Export pipeline:
- exportTrackChanges.ts injects tracking tokens into serialized HTML
- exportComments.ts handles comment-specific OOXML generation
- html-to-docx enhanced with comments.xml, commentsExtended.xml,
  commentsIds.xml, commentsExtensible.xml, and people.xml generation
- Proper paraId threading for reply chains

App integration:
- import-toolbar-button.tsx: full DOCX import with user registration
- export-toolbar-button.tsx: export with discussions and suggestions
- suggestion-node-docx.tsx: DOCX-safe suggestion rendering (no ins/del)
- discussion-kit.tsx: paraId fields for round-trip fidelity
- docx-export-kit.tsx: SuggestionLeafDocx override for clean export

Key features:
- Suggestion authorship preserved through round-trip
- Comment threading via paraId/parentParaId linking
- UTC date handling for cross-timezone compatibility
- Overlapping comment ranges supported
- ImportedUser type for user store registration
@codesandbox
Copy link

codesandbox bot commented Feb 8, 2026

Review or Edit in CodeSandbox

Open the branch in Web EditorVS CodeInsiders

Open Preview

@changeset-bot
Copy link

changeset-bot bot commented Feb 8, 2026

⚠️ No Changeset found

Latest commit: 04d04d8

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@dosubot dosubot bot added the size:XXL This PR changes 1000+ lines, ignoring generated files. label Feb 8, 2026
@vercel
Copy link

vercel bot commented Feb 8, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

1 Skipped Deployment
Project Deployment Actions Updated (UTC)
plate Ignored Ignored Feb 8, 2026 10:36pm

Request Review

@dosubot dosubot bot added the plugin:docx label Feb 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

plugin:docx size:XXL This PR changes 1000+ lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant