Skip to content

feat(examples): vanilla custom UI tracked-changes example (SD-2929)#3132

Closed
caio-pizzol wants to merge 1 commit intocaio/sd-2929-vanilla-custom-ui-commentsfrom
caio/sd-2929-vanilla-custom-ui-track-changes
Closed

feat(examples): vanilla custom UI tracked-changes example (SD-2929)#3132
caio-pizzol wants to merge 1 commit intocaio/sd-2929-vanilla-custom-ui-commentsfrom
caio/sd-2929-vanilla-custom-ui-track-changes

Conversation

@caio-pizzol
Copy link
Copy Markdown
Contributor

Third focused minimal example under `examples/editor/custom-ui/`. Single file (~140 lines) demonstrating the tracked-changes review panel that pairs naturally with the comments composer.

The load-bearing piece is the single `ui.trackChanges.observe(snapshot => ...)` subscription that drives the list, the bulk-action enable state, and the active-row highlight from one source. Per-change verbs (`accept` / `reject`), bulk verbs (`acceptAll` / `rejectAll`), and navigation (`next` / `previous` / `scrollTo`) all live on `ui.trackChanges`. `ui.document.setMode` flips between Edit and Suggest so the user can demonstrate the flow without leaving the page.

`modules.trackChanges: { replacements: 'independent' }` surfaces typed-over selections as separate insert + delete review items instead of one composite. Matches what most review UIs (including this one) render.

Verified: `pnpm --filter superdoc build` clean; `tsc --noEmit` clean in the new example.

@linear
Copy link
Copy Markdown

linear Bot commented May 4, 2026

@caio-pizzol caio-pizzol force-pushed the caio/sd-2929-vanilla-custom-ui-comments branch from 77021d4 to 6af174a Compare May 4, 2026 23:38
@caio-pizzol caio-pizzol force-pushed the caio/sd-2929-vanilla-custom-ui-track-changes branch from d06e2be to de9e8f6 Compare May 4, 2026 23:38
@caio-pizzol caio-pizzol force-pushed the caio/sd-2929-vanilla-custom-ui-comments branch from 6af174a to a448478 Compare May 4, 2026 23:42
Third focused minimal example under examples/editor/custom-ui/.
Single file (~140 lines) demonstrating the tracked-changes review
panel that pairs naturally with the comments composer.

Patterns on display:
- ui.trackChanges.observe(snapshot => ...) drives the panel list AND
  the bulk-action enable state from one subscription.
- ui.trackChanges.accept(id) / .reject(id) for per-change decisions;
  .acceptAll() / .rejectAll() for bulk; .next() / .previous() /
  .scrollTo(id) for navigation. The snapshot's activeId reflects
  whichever change is under the cursor.
- ui.document.observe + setMode('editing' | 'suggesting') so the
  user can toggle between editing normally and recording each edit
  as a tracked change.
- modules.trackChanges: { replacements: 'independent' } surfaces
  typed-over selections as separate insert + delete review items
  instead of one composite, matching what most review UIs render.
- ui.createScope() collects every subscription so the whole surface
  tears down cleanly on ui.destroy().

Wired into examples/manifest.json and the custom-ui CI smoke matrix.
Stacked on caio/sd-2929-vanilla-custom-ui-comments.
@caio-pizzol caio-pizzol force-pushed the caio/sd-2929-vanilla-custom-ui-track-changes branch from de9e8f6 to e92ef6a Compare May 4, 2026 23:42
@caio-pizzol caio-pizzol closed this May 4, 2026
@caio-pizzol
Copy link
Copy Markdown
Contributor Author

Closing this for now after the Custom UI examples audit. We're going to keep examples docs-driven and concept-shaped, not surface-shaped. The next Custom UI examples should be focused vanilla examples linked from specific docs pages: selection-capture/vanilla first, then possibly configurable-toolbar/vanilla. Track changes stays inline / demo-only for now. Keeping the branch around for cherry-picking if useful.

The PublicToolbarItemId re-export fix that lived on this stack has been split out as #3135 so it can land independent of the examples conversation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant