Skip to content

feat: add undo/redo support for editing actions#1592

Open
ida-jemi wants to merge 1 commit into
magic-peach:mainfrom
ida-jemi:feat/undo-redo
Open

feat: add undo/redo support for editing actions#1592
ida-jemi wants to merge 1 commit into
magic-peach:mainfrom
ida-jemi:feat/undo-redo

Conversation

@ida-jemi

Copy link
Copy Markdown

Description

Adds undo/redo support for editing actions, as requested in the issue.

  • New useUndoRedo hook (src/hooks/useUndoRedo.ts) , a generic history stack with push, undo, redo, canUndo, canRedo, and reset. History is capped at 25 entries.
  • Wired into useVideoEditor: every recipe change is debounced ~400ms before being committed to history, so dragging sliders (brightness/contrast/trim) creates one history entry per gesture instead of one per pixel of drag.
  • Added Ctrl+Z (undo) and Ctrl+Shift+Z / Ctrl+Y (redo) keyboard shortcuts in useKeyboardShortcuts.ts.
  • Added Undo / Redo buttons next to "Reset all settings" in VideoEditor.tsx, disabled appropriately at either end of the stack.
  • History resets on new file upload and on "Reset all settings" / full reset.
  • Added unit tests covering push/undo/redo/cap/reset/no-op-on-duplicate-push behavior.

Scope note: file, musicFile, and overlayFile (actual File objects) are intentionally not part of the undo stack — only EditRecipe-level settings (trim, rotate, framing, speed, color, overlay position/size/opacity, format, text overlays) are tracked, matching the scope described in the issue.

Related Issue

Closes #1591

Type of Contribution

  • Bug fix
  • New feature
  • Documentation update
  • Refactor
  • GSSoC contribution

Participant Info

  • GitHub username: ida-jemi
  • Contribution level: Advanced

Screen Recording

Screen.Recording.2026-06-20.185121.mp4

Checklist

  • I have read the contribution guidelines
  • My changes follow the project structure
  • I have tested my changes in Chrome, Firefox, and Safari
  • bun run lint passes (no ESLint errors)
  • bunx tsc --noEmit passes (no TypeScript errors)
  • New interactive elements have aria-label / accessible names
  • No console.log statements left in
  • This PR is related to a valid issue
  • Screen recording attached above (required for UI/feature/design changes)

- Add generic useUndoRedo hook with debounced history stack (max 25 entries)
- Wire into useVideoEditor: push EditRecipe snapshots, expose undo/redo/canUndo/canRedo
- Add Ctrl+Z / Ctrl+Shift+Z / Ctrl+Y keyboard shortcuts
- Add Undo/Redo buttons next to Reset All Settings
- Update KeyboardShortcutsPanel with new shortcuts
- Add unit tests for useUndoRedo

Closes magic-peach#1591
@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@ida-jemi is attempting to deploy a commit to the magic-peach1's projects Team on Vercel.

A member of the Team first needs to authorize it.

@github-actions

Copy link
Copy Markdown
Contributor

✅ PR Format Check Passed — @ida-jemi

Basic format checks passed. A maintainer will review your code changes.

This does not mean the PR is approved — it just means the format is correct.

@github-actions github-actions Bot added level:advanced Advanced level - 55 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance type:refactor Code refactor type:testing Testing labels Jun 20, 2026
@github-actions

Copy link
Copy Markdown
Contributor

👋 Thanks for your PR, @ida-jemi!

Welcome to Reframe — a browser-based video editor built for everyone 🎬

🟠 GSSoC'26 PR detected — thanks for contributing under GirlScript Summer of Code 2026!

What happens next

  1. 🤖 Automated checks — build & TypeScript typecheck will run automatically
  2. Vercel preview — a preview deployment will be created (requires maintainer authorization for fork PRs)
  3. 👀 Code review — a maintainer will review your changes
  4. 🚀 Merge — once approved, your PR will be merged!

Quick checklist

  • PR title follows Conventional Commits (e.g. feat: add dark mode)
  • Linked the issue this PR closes (e.g. Closes #123)
  • Tested the changes locally (bun run dev)
  • Build passes (bun run build)

Useful links

Happy coding! 🎉

@github-actions github-actions Bot added the gssoc'26 GirlScript Summer of Code 2026 label Jun 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

gssoc'26 GirlScript Summer of Code 2026 level:advanced Advanced level - 55 pts type:bug Bug fix type:design UI/UX design type:docs Documentation type:feature New feature type:performance Performance type:refactor Code refactor type:testing Testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Add undo/redo support for editing actions

1 participant