Skip to content

feat(ChatPrompt): add submitOnEnter prop to control Enter behavior#77

Merged
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-b597f909
Jun 9, 2026
Merged

feat(ChatPrompt): add submitOnEnter prop to control Enter behavior#77
IgorShevchik merged 1 commit into
mainfrom
sync/nuxt-b597f909

Conversation

@IgorShevchik

Copy link
Copy Markdown
Collaborator

Live sync — next commit in queue

Upstream: b597f909 — feat(ChatPrompt): add submitOnEnter prop to control Enter behavior (resolves nuxt/ui#6177)

Immediate next commit after efd7b8ec (#76) in the oldest-first queue.

What & why

Adds a submitOnEnter prop (default true) to ChatPrompt:

  • trueEnter submits, Shift+Enter inserts a newline (current behavior).
  • falseEnter inserts a newline, Ctrl+Enter / Cmd+Enter submits.

Applied 1:1 with upstream:

+  submitOnEnter?: boolean        // default true
+
+function handleEnter(event: KeyboardEvent) {
+  if (props.submitOnEnter) {
+    if (event.shiftKey || event.ctrlKey || event.metaKey || event.altKey) return
+  } else {
+    if (!event.ctrlKey && !event.metaKey) return
+  }
+  onEnter(event)
+}
-      @keydown.enter.exact="onEnter"
+      @keydown.enter="handleEnter"

The existing IME-guard (useIMEGuardonEnter / onCompositionEnd) is preserved. Docs note + 3 behavioral specs added.

b24ui divergence: none functional — only the slots-type prop stays b24ui (vs upstream ui), which is the pre-existing library-wide rename. Not a breaking change (new optional prop, default keeps old behavior).

Ledger (per-port maintenance, #75 §1)

  • .sync/nuxt-ui.json: cursorb597f909; previous efd7b8ec entry finalized (pr: 76, b24ui_sha: d9debe3e) — the rolling-correction pattern.
  • .sync/log/b597f909….md: decision record.

Validation (linux verify script; windows .ps1 below in chat)

  • dev:prepare · ✅ eslint · ✅ typecheck
  • ✅ ChatPrompt spec 38 passed (+3) · ✅ full pnpm exec vitest run (no -u) 4892 passed | 6 skipped

https://claude.ai/code/session_01Qz7EXMncvEGiCj4WbmYgJo


Generated by Claude Code

Port of nuxt/ui b597f909 (resolves nuxt/ui#6177). Adds a `submitOnEnter`
prop (default true):
- true: Enter submits, Shift+Enter inserts a newline.
- false: Enter inserts a newline, Ctrl/Cmd+Enter submits.

Implemented via a `handleEnter` gate on the textarea `@keydown.enter`
(replacing `.enter.exact`), preserving the existing IME-guard. Docs note
+ 3 behavioral specs added.

Ledger: cursor -> b597f909; efd7b8ec entry finalized (pr #76, d9debe3).

Upstream: b597f909aa9f4b12f3c732ec75f52226bcf88c2e
@IgorShevchik IgorShevchik merged commit 91c397f into main Jun 9, 2026
1 check passed
@IgorShevchik IgorShevchik deleted the sync/nuxt-b597f909 branch June 9, 2026 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

configurable multiline behavior for UChatPrompt

2 participants