Skip to content

fix: prevent Enter key from inserting newline before submit#346

Open
hakonharnes wants to merge 1 commit intocgoinglove:mainfrom
hakonharnes:fix/enter-key-newline-insertion
Open

fix: prevent Enter key from inserting newline before submit#346
hakonharnes wants to merge 1 commit intocgoinglove:mainfrom
hakonharnes:fix/enter-key-newline-insertion

Conversation

@hakonharnes
Copy link
Contributor

@hakonharnes hakonharnes commented Dec 3, 2025

When the cursor is in the middle of text (e.g., "hello (cursor) world") and pressing Enter to submit, the message would be sent as "hello \nworld" instead of "hello world". This happens because the React onKeyDown handler on EditorContent fires after Tiptap has already processed the Enter key and inserted a newline.

This PR moves the Enter key handling to Tiptap's handleKeyDown in editorProps, which intercepts keystrokes before the editor processes them.

@vercel
Copy link

vercel bot commented Dec 3, 2025

Someone is attempting to deploy a commit to the cgoinglove's projects Team on Vercel.

A member of the Team first needs to authorize it.

@hakonharnes hakonharnes force-pushed the fix/enter-key-newline-insertion branch from 889cbb7 to 4f1ff3d Compare December 3, 2025 18:53
@hakonharnes hakonharnes force-pushed the fix/enter-key-newline-insertion branch from 4f1ff3d to cf9b7fa Compare January 21, 2026 22:42
hakonharnes added a commit to hakonharnes/better-chatbot that referenced this pull request Jan 22, 2026
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.

1 participant