Skip to content

feat(track-changes): block-level & structural tracked changes#3

Open
dawidbudaszewski wants to merge 1 commit into
mainfrom
feat/structural-tracked-changes
Open

feat(track-changes): block-level & structural tracked changes#3
dawidbudaszewski wants to merge 1 commit into
mainfrom
feat/structural-tracked-changes

Conversation

@dawidbudaszewski

Copy link
Copy Markdown
Owner

Summary

Adds block-level / structural tracked changes to SuperDoc, on top of the existing inline (character-level) track-changes. Structural edits β€” table add/remove, table column add/delete, and rich paragraph / list / image block replacements β€” now surface as accept/reject-able suggestions and render correctly in the paginated review view. This is the engine behind the al-pmo "Compare my UI edits" review flow.

Tracking PR within the fork. Captures the full body of work on one branch so we can review, test, and plan a release (publish a new -scale.x and bump the al-pmo dependency).

What's included

New structural-track-changes extension

  • setStructuralDiff command (registered in editors/v1/index.js).
  • computeStructuralDiff β€” matches top-level blocks by a content/structural fingerprint (not sdBlockId, which is reassigned on every import) and emits remove / insert hunks. Supports optional ordinal replace pairing (shared operationId) so a changed block collapses into a single "replaced X with Y" review action.
  • applyHunks β€” applies hunks as block tracked changes.
  • Unit tests for both helpers.

Block tracked-change plumbing (track-changes)

  • blockTrackedChangeAttr, acceptRejectBlockTrackedChange, getBlockTrackedChanges, structuralBlockChanges (+ tests).
  • Structural-change detection in trackedTransaction and transaction-touches-structural-change.

Rendering

  • Layout-adapter tracked-changes.ts + paragraph.ts converter render block tracked changes in the review/paginated view (+ tests).

Table column grid fix

  • table.js: clear the now-stale grid attr on column add/delete so the DOCX exporter (preferTableGrid) stops slicing newly added columns back off, keeping the column count in sync across export/round-trip (+ regression tests).

Doc-API + misc

  • Tracked-change resolver / type-utils / index / snapshot updates.
  • Comments: dialog + store + plugin enhancements.
  • SuperdocDev.vue dev-harness wiring for manual testing.

Test plan

  • pnpm --filter @super-editor test (unit suites for the new extension, table, layout-adapter)
  • Manual: table column add (middle + right edge), table border removal, image insert, list/paragraph block edits all surface as a single pending change and render correctly before/after accept
  • Round-trip: export β†’ reimport preserves added columns
  • Decide release path: publish @scale/superdoc -scale.x, bump al-pmo dependency, drop the local link: override
  • Triage pre-existing lint warnings (unused vars) flagged by the pre-commit hook

Made with Cursor

Adds whole-block (paragraph/table) tracked-change support on top of the
existing inline track-changes, so structural edits β€” table add/remove, list/
image/paragraph block replacements, and table column add/delete β€” surface as
accept/reject-able suggestions and render correctly in the paginated review view.

- New `structural-track-changes` extension: `setStructuralDiff` command,
  `computeStructuralDiff` (block matching by content/structural fingerprint with
  optional ordinal replace pairing via operationId) and `applyHunks` (+ tests).
- Block tracked-change plumbing in `track-changes`: block tracked-change attr,
  accept/reject helpers, query helpers, and structural-change detection in
  tracked transactions.
- Layout-adapter + paragraph converter render block tracked changes in the
  review/paginated view.
- Table: clear the now-stale `grid` attr on column add/delete so the DOCX
  exporter (preferTableGrid) stops slicing added columns back off and the
  column count stays in sync across export/round-trip (+ regression tests).
- Doc-API tracked-change resolver / type-utils / index / snapshot updates.
- Comments: dialog + store + plugin enhancements.
- Dev harness (SuperdocDev.vue) wiring for manual testing.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant