Skip to content

Enhanced ChatGPT Clone: Features Agents, MCP, Skills, DeepSeek, Anthropic, AWS, OpenAI, Responses API, Azure, Groq, o1, GPT-5, Mistral, OpenRouter, Vertex AI, Gemini, Artifacts, AI model switching, message search, Code Interpreter, langchain, DALL-E-3, OpenAPI Actions, Functions, Secure Multi-User Auth, Presets, open-source for self-hosting. Active

🪲 fix(useTextarea): enterToSend bugs (#2988)

Marco Beretta68bf7ac7c01f
diff --git a/client/src/hooks/Input/useTextarea.ts b/client/src/hooks/Input/useTextarea.ts
index 569766784c..5a56685ad5 100644
--- a/client/src/hooks/Input/useTextarea.ts
+++ b/client/src/hooks/Input/useTextarea.ts
@@ -163,6 +163,7 @@ export default function useTextarea({
}
const isNonShiftEnter = e.key === 'Enter' && !e.shiftKey;
+ const isCtrlEnter = e.key === 'Enter' && e.ctrlKey;
if (isNonShiftEnter && filesLoading) {
e.preventDefault();
@@ -172,13 +173,14 @@ export default function useTextarea({
e.preventDefault();
}
- if (e.key === 'Enter' && !enterToSend && textAreaRef.current) {
+ if (e.key === 'Enter' && !enterToSend && !isCtrlEnter && textAreaRef.current) {
+ e.preventDefault();
insertTextAtCursor(textAreaRef.current, '\n');
forceResize(textAreaRef);
return;
}
- if (isNonShiftEnter && !isComposing?.current) {
+ if ((isNonShiftEnter || isCtrlEnter) && !isComposing?.current) {
const globalAudio = document.getElementById(globalAudioId) as HTMLAudioElement;
if (globalAudio) {
console.log('Unmuting global audio');