feat(editor): return-to-recording action and project menu (#513) - #796
feat(editor): return-to-recording action and project menu (#513)#796iOSDevSK wants to merge 1 commit into
Conversation
…lorg#513) Adds the "Return to recording" action requested in webadderallorg#513 and makes the project file actions reachable from the editor UI. Return to recording: - New camera button in the editor header (and on the "no video" screen) that leaves the editor and brings the recording HUD back. - Reuses the existing unsaved-changes dialog, so the project can be saved, discarded, or the action canceled. - Blocked while an export is running, since closing the editor window would otherwise kill the export silently. - In the main process the HUD is shown *before* the editor window is closed: on non-macOS platforms `window-all-closed` quits the app, so a window has to exist at all times. The editor is closed through `closeEditorWindowBypassingUnsavedPrompt` so the native "Unsaved Changes" prompt does not fire a second time after the renderer dialog. Project menu: - New header dropdown with New recording, New project from file, Open projects, Save project and Save project as. - Save/Save As/Open were previously reachable only through the macOS application menu. Windows and Linux run with `Menu.setApplicationMenu(null)`, so there was no way to save a project at all on those platforms. The editor now binds Ctrl+S, Ctrl+Shift+S and Ctrl+O itself off macOS, and Cmd/Ctrl+N everywhere. - The new bindings are registered in FIXED_SHORTCUTS so users cannot rebind a configurable action on top of them. Ripple delete, the other half of webadderallorg#513, is not part of this change. Translations added for all 10 supported locales plus ru; `npm run i18n:check` passes. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe editor now supports returning to recording, project creation and management, keyboard shortcuts, project menus, and localized labels. Electron exposes the recording transition through the preload bridge and IPC handler. ChangesEditor to recording navigation
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant VideoEditor
participant Preload
participant ElectronMain
participant RecordingHUD
VideoEditor->>Preload: switchToRecording()
Preload->>ElectronMain: switch-to-recording IPC
ElectronMain->>RecordingHUD: restore or create HUD
ElectronMain->>VideoEditor: close editor without native prompt
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/video-editor/VideoEditor.tsx`:
- Around line 4600-4603: Update the keyboard shortcut branch in VideoEditor’s
key handler so the "n" path calls handleReturnToRecording only when the
control/meta modifier is valid and e.shiftKey is false, leaving Ctrl/Cmd+Shift+N
unhandled.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: c0ef0b3c-a684-4120-aec4-c94fa2044afa
📒 Files selected for processing (16)
electron/electron-env.d.tselectron/main.tselectron/preload.tssrc/components/video-editor/VideoEditor.tsxsrc/i18n/locales/de/editor.jsonsrc/i18n/locales/en/editor.jsonsrc/i18n/locales/es/editor.jsonsrc/i18n/locales/fr/editor.jsonsrc/i18n/locales/it/editor.jsonsrc/i18n/locales/ko/editor.jsonsrc/i18n/locales/nl/editor.jsonsrc/i18n/locales/pt-BR/editor.jsonsrc/i18n/locales/ru/editor.jsonsrc/i18n/locales/zh-CN/editor.jsonsrc/i18n/locales/zh-TW/editor.jsonsrc/lib/shortcuts.ts
| if (key === "n") { | ||
| e.preventDefault(); | ||
| void handleReturnToRecording(); | ||
| return; |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Ignore Shift for the New Recording shortcut.
Ctrl+Shift+N and Cmd+Shift+N also return to recording because this branch does not check e.shiftKey. This shortcut is not displayed or registered. Require !e.shiftKey before handling key === "n".
Proposed fix
- if (key === "n") {
+ if (key === "n" && !e.shiftKey) {📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if (key === "n") { | |
| e.preventDefault(); | |
| void handleReturnToRecording(); | |
| return; | |
| if (key === "n" && !e.shiftKey) { | |
| e.preventDefault(); | |
| void handleReturnToRecording(); | |
| return; |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@src/components/video-editor/VideoEditor.tsx` around lines 4600 - 4603, Update
the keyboard shortcut branch in VideoEditor’s key handler so the "n" path calls
handleReturnToRecording only when the control/meta modifier is valid and
e.shiftKey is false, leaving Ctrl/Cmd+Shift+N unhandled.
Closes part of #513.
Problem
Once you are in the editor there is no way out. #513 asks for a "Return to recording" action in the editor header, and today the only way to discard a recording and get back to the source picker is to quit the whole app and relaunch it.
While implementing that I hit a second, related gap: on Windows and Linux a project cannot be saved at all.
Save Project,Save Project AsandOpen Projectsexist only as macOS application-menu items, andsetupApplicationMenu()callsMenu.setApplicationMenu(null)on every other platform. There is no renderer-side keybinding and no button, so those accelerators simply do not exist off macOS.Changes
Return to recording
confirmReplaceSourceWithUnsavedChangesflow, so the user gets the familiar Save project / Discard changes / Cancel dialog rather than losing work.switch-to-recordingIPC handler in the main process.Two ordering details in
returnToRecording()that are easy to get wrong:window-all-closedquits the app on non-darwin platforms, so a window has to exist throughout. ReassigningmainWindowfirst also stops the editor's ownclosedhandler (if (mainWindow === editorWindow)) from nulling the freshly restored HUD reference.closeEditorWindowBypassingUnsavedPrompt. The renderer has already asked about unsaved changes at that point, buteditorHasUnsavedChangesis stilltruein the main process, so a plainwindow.close()would pop the native "Unsaved Changes" dialog a second time.Project menu
New header dropdown so the project actions are discoverable and, more importantly, available on every platform:
⌘N/Ctrl+N)⌘O/Ctrl+O)⌘S/Ctrl+S)⇧⌘S/Ctrl+Shift+S)The editor now binds
Ctrl+S,Ctrl+Shift+SandCtrl+Oitself only off macOS — on macOS those accelerators belong to the application menu and are swallowed before the keydown reaches the renderer, so binding them in both places would double-fire (visibly bad forCtrl+O, which toggles the projects popover).Cmd/Ctrl+Nis bound on all platforms since no menu item claims it.The four new combinations are added to
FIXED_SHORTCUTS, sofindConflict()stops users from rebinding a configurable action on top of them.Not included
Ripple delete — the timeline half of #513 (
Backspace/Deleteon a clip, shifting subsequent clips and regions left) — is not part of this PR. It is a much larger change to the timeline model and is better reviewed separately.i18n
editor.actions.returnToRecording,editor.actions.returnToRecordingBlockedByExportand sixeditor.project.*keys, translated for all 10 locales inSUPPORTED_LOCALESplus therudirectory thati18n-checkalso validates.Verification
npm test— 996 tests across 106 files passtsc --noEmit— cleannpm run i18n:check— locale files structurally consistentbiome format/biome lint— no new findings on the touched fileselectron-builderfor macOS arm64 and launch-tested🤖 Generated with Claude Code
Summary by CodeRabbit