mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-12-17 08:50:15 +01: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 isNonShiftEnter = e.key === 'Enter' && !e.shiftKey;
|
||||||
|
const isCtrlEnter = e.key === 'Enter' && e.ctrlKey;
|
||||||
|
|
||||||
if (isNonShiftEnter && filesLoading) {
|
if (isNonShiftEnter && filesLoading) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|
@ -172,13 +173,14 @@ export default function useTextarea({
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.key === 'Enter' && !enterToSend && textAreaRef.current) {
|
if (e.key === 'Enter' && !enterToSend && !isCtrlEnter && textAreaRef.current) {
|
||||||
|
e.preventDefault();
|
||||||
insertTextAtCursor(textAreaRef.current, '\n');
|
insertTextAtCursor(textAreaRef.current, '\n');
|
||||||
forceResize(textAreaRef);
|
forceResize(textAreaRef);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isNonShiftEnter && !isComposing?.current) {
|
if ((isNonShiftEnter || isCtrlEnter) && !isComposing?.current) {
|
||||||
const globalAudio = document.getElementById(globalAudioId) as HTMLAudioElement;
|
const globalAudio = document.getElementById(globalAudioId) as HTMLAudioElement;
|
||||||
if (globalAudio) {
|
if (globalAudio) {
|
||||||
console.log('Unmuting global audio');
|
console.log('Unmuting global audio');
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue