mirror of
https://github.com/danny-avila/LibreChat.git
synced 2025-09-22 06:00:56 +02:00
🉐 fix: incorrect handling for composing CJK texts in Safari (#5496)
This commit is contained in:
parent
5f8fade7eb
commit
47b72e8159
1 changed files with 5 additions and 2 deletions
|
@ -191,6 +191,9 @@ export default function useTextarea({
|
|||
const isNonShiftEnter = e.key === 'Enter' && !e.shiftKey;
|
||||
const isCtrlEnter = e.key === 'Enter' && (e.ctrlKey || e.metaKey);
|
||||
|
||||
// NOTE: isComposing and e.key behave differently in Safari compared to other browsers, forcing us to use e.keyCode instead
|
||||
const isComposingInput = isComposing.current || e.key === 'Process' || e.keyCode === 229;
|
||||
|
||||
if (isNonShiftEnter && filesLoading) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
@ -204,7 +207,7 @@ export default function useTextarea({
|
|||
!enterToSend &&
|
||||
!isCtrlEnter &&
|
||||
textAreaRef.current &&
|
||||
!isComposing.current
|
||||
!isComposingInput
|
||||
) {
|
||||
e.preventDefault();
|
||||
insertTextAtCursor(textAreaRef.current, '\n');
|
||||
|
@ -212,7 +215,7 @@ export default function useTextarea({
|
|||
return;
|
||||
}
|
||||
|
||||
if ((isNonShiftEnter || isCtrlEnter) && !isComposing.current) {
|
||||
if ((isNonShiftEnter || isCtrlEnter) && !isComposingInput) {
|
||||
const globalAudio = document.getElementById(globalAudioId) as HTMLAudioElement | undefined;
|
||||
if (globalAudio) {
|
||||
console.log('Unmuting global audio');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue