Selected: nonemain selected
Editing action preview
A focused action strip for selection, clipboard, history, and marker hooks.
Installation
pnpm add @techsquidtv/canvas-timeline-reactnpm install @techsquidtv/canvas-timeline-reactyarn add @techsquidtv/canvas-timeline-reactbun add @techsquidtv/canvas-timeline-react- 1
Install the package.
The command above adds the React bindings and their package dependencies.
- 2
Import from the React entrypoint.
@techsquidtv/canvas-timeline-react/hooks
Usage
import { fromSeconds } from '@techsquidtv/canvas-timeline-utils';import { useTimelineClips, useTimelineClipboard, useTimelineEditCommands, useTimelineEditMode, useTimelineEditPreview, useTimelineHistory, useTimelineRangeSelection,} from '@techsquidtv/canvas-timeline-react/hooks';
export function EditActions() { const { selectedClip } = useTimelineClips(); const { copySelection } = useTimelineClipboard(); const editMode = useTimelineEditMode(); const editCommands = useTimelineEditCommands(); const editPreview = useTimelineEditPreview(); const rangeSelection = useTimelineRangeSelection(); const { canUndo, undo } = useTimelineHistory();
return ( <> {editPreview.previewing && <span>{editPreview.impacts.length} clips affected</span>} <button onClick={() => editMode.setMode('trim')}>Trim</button> <button disabled={!selectedClip} onClick={copySelection}>Copy</button> <button disabled={!selectedClip} onClick={() => selectedClip && editCommands.moveClip({ clipId: selectedClip.id, startTime: fromSeconds(4), }) } > Move </button> <button disabled={!rangeSelection.hasRange} onClick={() => rangeSelection.liftRange()}> Lift </button> <button disabled={!canUndo} onClick={undo}>Undo</button> </> );}Notes
useActiveMarkersis a live playhead hook; compose it only in marker readouts or navigation that should update while scrubbing.useTimelineEditCommandscalls TimelineEngine command APIs for validation, preview, commit, and cancel flows.useTimelineEditPreviewis the shared command preview hook for custom guide affordances and renderer-facing impact state.useTimelineEditImpactsis a live interaction hook; compose it in UI that needs drag-time edit consequences, not broad toolbar state.useTimelineClipDropFeedbackis a live interaction hook; compose it in focused drag affordances instead of broad editor chrome.
API Reference
Editing Hooks
Hooks for edit modes, typed commands, previews, range edits, selection, clipboard, and history.
Exports
clip editing
| Name | Reference | Description |
|---|---|---|
useTimelineClips | API reference | Reads timeline clips and exposes canonical clip editing commands. |
useTimelineEditMode | API reference | Owns local edit-mode state for product toolbar chrome. |
useTimelineEditCommands | API reference | Builds, previews, validates, commits, and cancels typed edit commands. |
selection
| Name | Reference | Description |
|---|---|---|
useTimelineSelection | API reference | Reads selected clip and track state with selection commands. |
useTimelineRangeSelection | API reference | Adapts In/Out points to delete-range and lift-range edit commands. |
track editing
| Name | Reference | Description |
|---|---|---|
useTimelineTracks | API reference | Reads track state and exposes track management commands. |
useTimelineTrack | API reference | Reads one track, canvas-aligned row geometry, and track commands. |
useTimelineTrackHeader | API reference | Returns DOM-ready track header props for one track row. |
control adapter
| Name | Reference | Description |
|---|---|---|
useTimelineTrackLockControl | API reference | Returns semantic button props for toggling one track lock. |
marker editing
| Name | Reference | Description |
|---|---|---|
useTimelineMarkers | API reference | Reads markers and exposes marker editing commands. |
useActiveMarkers | API reference | Subscribes to live active, nearest, previous, and next markers. |
clipboard
| Name | Reference | Description |
|---|---|---|
useTimelineClipboard | API reference | Provides copy, cut, and paste commands for timeline clips. |
history
| Name | Reference | Description |
|---|---|---|
useTimelineHistory | API reference | Exposes undo and redo availability with history commands. |
edit preview
| Name | Reference | Description |
|---|---|---|
useClipEditPreview | API reference | Reads transient clip edit preview state during trims and cuts. |
useTimelineEditImpacts | API reference | Subscribes to live edit impacts produced by active timeline interactions. |
useTimelineEditPreview | API reference | Subscribes to the shared command-layer edit preview. |
drag drop
| Name | Reference | Description |
|---|---|---|
useTimelineClipDrag | API reference | Provides headless clip body dragging, including cross-track drop resolution. |
useTimelineTrackDropTargets | API reference | Exposes track row drop targets and default same-kind track compatibility. |
useTimelineClipDropFeedback | API reference | Subscribes to live cross-track clip drop feedback for custom affordances. |
keyframe editing
| Name | Reference | Description |
|---|---|---|
useTimelineKeyframeDrag | API reference | Provides headless keyframe handle dragging with live property preview updates. |
useTimelineKeyframeCurveDrag | API reference | Provides headless Bezier curve handle dragging with live easing preview updates. |