mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🪲 fix(useTextarea): enterToSend bugs (#2988)
Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
parent
97d12d03d1
commit
68bf7ac7c0
1 changed files with 4 additions and 2 deletions
|
@ -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');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue