cutiva

Commands and undo

Every edit in Cutiva is a serializable command.

You never mutate a project directly. You dispatch a command, a plain object the core validates and applies. If it fails, nothing changes.

const { leftId, rightId } = editor.dispatch({ type: "clip.split", clipId, atUs: 12_000_000 });
editor.undo();
editor.redo();
CommandWhat it does
clip.addPlace an asset on a track (end of track by default)
clip.splitCut a clip in two at a timeline time
clip.trimChange a clip's source in or out point
clip.moveMove a clip to a new time or track
clip.reorderMove a clip to an index and close gaps
clip.removeDelete a clip, optionally closing the gap
clip.setVolume, clip.setSpeed, clip.setFadeAdjust a clip
track.add, track.setMutedManage tracks

editor.batch([...]) applies several commands as one undo step, all or nothing. Errors are CutivaError objects with a stable code, such as OVERLAP or INVALID_RANGE.