@stesura/track-changes-react
Track-changes UI for @stesura/track-changes. Most hosts only pass trackChangesUIExtension to uiExtensions; see React components.
UI extension
trackChangesUIExtension
Pass to the editor’s uiExtensions: context-menu accept/reject, the review
tab’s track-changes group, the status bar’s on/off entry, and the
format-change hover tooltip. The components are also exported individually
for custom chrome.
Toolbar
TrackChangesGroup
The review tab’s track-changes group: tracking toggle, visibility toggle, accept and reject.
| Name | Type | Default |
|---|---|---|
props | {} |
ToggleTrackChangesButton
Toggles whether edits are recorded as suggestions. Active while tracking is on.
In "review" mode it shows active and locked, since every edit is tracked
there regardless of the plugin flag. Locked uses aria-disabled rather than
disabled, which would swallow the pointer events the explanatory tooltip needs.
| Name | Type | Default |
|---|---|---|
props | {} |
ToggleTrackChangesVisibilityButton
Toggles whether pending suggestions are shown. Tracking keeps running while they are hidden; the document then reads as if everything were accepted.
| Name | Type | Default |
|---|---|---|
props | {} |
TrackChangesAcceptButton
Accept split button: accept-and-next, accept all, or accept all and stop tracking.
| Name | Type | Default |
|---|---|---|
props | {} |
TrackChangesRejectButton
Reject split button: reject-and-next, reject all, or reject all and stop tracking.
| Name | Type | Default |
|---|---|---|
props | {} |
Menus and tooltips
TrackChangesContextMenu
Accept/reject entries for the context menu; renders nothing unless the cursor
is on a pending change. The group label (chips + author/date) describes both
items via aria-describedby, making it the keyboard equivalent of the hover
tooltip.
TrackChangesModificationTooltip
Hover tooltip describing pending format changes (”+ Bold”) with author and
date. Mounted through documentOverlaySlot by trackChangesUIExtension.
Hidden while suggestions are hidden. Being viewport-fixed and a reading of
one doc version, it’s dismissed on mousedown, scroll or leaving the editor,
and hidden once the doc changes.
The visual box is aria-hidden: the hovered markup isn’t React-owned, so
nothing can reference it. The text goes to an always-mounted polite live
region instead, which also speaks announceResolution messages (TC-88).
Keyboard users get the same information from the context menu.