fix: solve #5263 — Enter submits the New Workspace prompt
Root cause
The active New Workspace modal (V2, DashboardNewWorkspaceModal) renders its prompt with MarkdownEditor (Tiptap). In that editor, plain Enter inserts a newline and submission only happened via a window-level keydown listener gated on isEnterSubmit(e, { requireMod: true }) — i.e. Cmd/Ctrl+Enter. This made the launcher the outlier: the in-workspace chat composer (TiptapPromptEditor) already submits on plain Enter and uses Shift+Enter for a newline.
Affected code:
apps/desktop/src/renderer/components/MarkdownEditor/MarkdownEditor.tsx— no plain-Enter submit path.apps/desktop/src/renderer/routes/_authenticated/components/DashboardNewWorkspaceModal/components/DashboardNewWorkspaceForm/PromptGroup/PromptGroup.tsx— Cmd+Enter-only submit +⌘↵hint.
The fix
resolveEnterActionhelper (pure, co-located) encodes the submit policy:Enter → submit,Shift+Enter → newline, deferring to IME composition and open suggestion menus, and falling back to the editor default when no submit handler is wired. This keeps the policy unit-testable without a DOM.MarkdownEditorgains an opt-inonEnterprop. A high-priority keyboard-shortcut extension usesresolveEnterActionso plain Enter submits (before HardBreak can insert a line break) and Shift+Enter inserts a newline. WhenonEnteris omitted, behavior is unchanged (backward compatible).- New Workspace prompt passes
onEnter={handleSubmit}and the hint changes from⌘↵to↵. Cmd/Ctrl+Enter still submits through the existing window-level listener (requireMod: true), so there is no double-fire and the power-user shortcut keeps working.
The second, legacy modal (NewWorkspaceModal, used when V2 cloud is disabled) already submits on plain Enter via PromptInputTextarea, so it needed no change.
Tests
apps/desktop/src/renderer/components/MarkdownEditor/resolveEnterAction.test.tsreproduces the reported expectation and pins the policy: plain Enter → submit, Shift+Enter → newline, no-handler → editor default, IME/suggestion-open → deferred.bun testpasses;bun run lintandbun run typecheckare clean.
Notes
- The issue also proposed a configurable Settings → Keyboard preference. That is intentionally not included here to keep the change minimal and low-risk; the editor now reads its submit policy through one helper, which is the natural seam for wiring a preference later.
Closes #5263
Summary by cubic
Enter now submits the New Workspace prompt (V2 modal), with Shift+Enter for newline, matching the chat composer. Keeps Cmd/Ctrl+Enter and fixes #5263.
- Bug Fixes
- Added a pure resolveEnterAction helper and an opt-in onEnter to the editor; behavior is unchanged when onEnter is not provided.
- Wired onEnter in the New Workspace form and updated the hint from ⌘↵ to ↵.
- Kept the window-level Cmd/Ctrl+Enter path to avoid double-submit; added unit tests for the enter policy.