Track Changes Suite — 7 components for document revision tracking and collaboration.
Provides visual change tracking (insert/delete marks), inline diffs, accept/reject controls, editing mode toggles, sharing permissions, and auto-save status indicators. Designed to complement the TipTap editor suite and OT engine.
Components
track_change_mark/1— inline<ins>/<del>annotation with author metadatatrack_change_panel/1— sidebar panel listing all tracked changes with accept/rejecttrack_change_toggle/1— segmented control for editing / suggesting / viewing modesaccept_reject_controls/1— toolbar with accept/reject current + accept/reject all buttonschange_diff_inline/1— inline diff view showing old (red) and new (green) textshare_permissions_dialog/1— modal dialog for managing document sharing and rolesauto_save_indicator/1— status dot with label showing save state
Example
<.track_change_mark type={:insert} author="Alice">
new text here
</.track_change_mark>
<.track_change_panel id="changes" changes={@tracked_changes} />
<.track_change_toggle id="mode" mode={@edit_mode} />
<.auto_save_indicator status={@save_status} last_saved={@last_saved_at} />
Summary
Functions
Renders a toolbar with four action buttons for tracked changes
Renders a compact auto-save status indicator with a colored dot and label.
Renders an inline diff view showing the old text struck through in red and the new text highlighted in green.
Renders a modal dialog for managing document sharing permissions.
Renders an inline tracked change annotation.
Renders a panel listing all tracked changes with accept/reject buttons per change.
Renders a segmented control for switching between editing modes.
Functions
Renders a toolbar with four action buttons for tracked changes:
- Accept current change
- Reject current change
- Accept all changes
- Reject all changes
All buttons are disabled when :has_changes is false.
Emits phx-click events: "track_change:accept_current",
"track_change:reject_current", "track_change:accept_all",
"track_change:reject_all" with the editor_id as value.
Example
<.accept_reject_controls
id="ar-controls"
editor_id="my-editor"
has_changes={length(@tracked_changes) > 0}
/>Attributes
id(:string) (required)editor_id(:string) (required)has_changes(:boolean) - Defaults tofalse.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a compact auto-save status indicator with a colored dot and label.
Statuses:
:saved— green dot, "Saved" text:saving— amber animated dot, "Saving..." text:unsaved— gray dot, "Unsaved changes" text:error— red dot, "Save failed" text
When :last_saved is provided, it is displayed as secondary text for
the :saved status.
Example
<.auto_save_indicator status={:saving} />
<.auto_save_indicator status={:saved} last_saved="2 min ago" />Attributes
status(:atom) - Defaults to:saved. Must be one of:saved,:saving,:unsaved, or:error.last_saved(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Renders an inline diff view showing the old text struck through in red and the new text highlighted in green.
Uses simple <del> and <ins> elements for semantic correctness
and accessibility.
Example
<.change_diff_inline
old_text="Hello World"
new_text="Hello Elixir"
/>Attributes
old_text(:string) - Defaults to"".new_text(:string) - Defaults to"".class(:string) - Defaults tonil.- Global attributes are accepted.
Renders an inline tracked change annotation.
Wraps content in <ins> (for inserts) or <del> (for deletes) with
appropriate visual styling and optional author/timestamp metadata.
- Insert: green background, underline decoration
- Delete: red background, strikethrough decoration
Example
<.track_change_mark type={:insert} author="Alice" timestamp="2 min ago">
added text
</.track_change_mark>
<.track_change_mark type={:delete} author="Bob">
removed text
</.track_change_mark>Attributes
type(:atom) (required) - Must be one of:insert, or:delete.author(:string) - Defaults tonil.timestamp(:string) - Defaults tonil.class(:string) - Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required)
Renders a panel listing all tracked changes with accept/reject buttons per change.
Each change in the :changes list should be a map with:
:type—:insertor:delete:text— the changed text content:author— author name (optional):timestamp— human-readable timestamp (optional)
Example
<.track_change_panel
id="changes-panel"
changes={[
%{type: :insert, text: "new text", author: "Alice", timestamp: "2 min ago"},
%{type: :delete, text: "old text", author: "Bob", timestamp: "5 min ago"}
]}
/>Attributes
id(:string) (required)changes(:list) - Defaults to[].class(:string) - Defaults tonil.- Global attributes are accepted.
Renders a segmented control for switching between editing modes.
Modes:
:editing— direct editing (no tracking):suggesting— changes are tracked as suggestions:viewing— read-only view with visible tracked changes
Emits "track_change:mode" phx-click events with phx-value-mode.
Example
<.track_change_toggle id="edit-mode" mode={@edit_mode} />Attributes
id(:string) (required)mode(:atom) - Defaults to:editing. Must be one of:editing,:suggesting, or:viewing.class(:string) - Defaults tonil.- Global attributes are accepted.