From 3750200c5e6ddc3ba5915e8a1db6e62036c0324f Mon Sep 17 00:00:00 2001 From: crazywoola <100913391+crazywoola@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:30:34 +0800 Subject: [PATCH] feat: add a meta(mac) ctrl(windows) key (#10978) --- .../base/chat/chat/chat-input-area/index.tsx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/web/app/components/base/chat/chat/chat-input-area/index.tsx b/web/app/components/base/chat/chat/chat-input-area/index.tsx index 5169e65a59..eec636b478 100644 --- a/web/app/components/base/chat/chat/chat-input-area/index.tsx +++ b/web/app/components/base/chat/chat/chat-input-area/index.tsx @@ -102,21 +102,21 @@ const ChatInputArea = ({ setCurrentIndex(historyRef.current.length) handleSend() } - else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing) { - // When the up key is pressed, output the previous element + else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) { + // When the cmd + up key is pressed, output the previous element if (currentIndex > 0) { setCurrentIndex(currentIndex - 1) setQuery(historyRef.current[currentIndex - 1]) } } - else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing) { - // When the down key is pressed, output the next element + else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) { + // When the cmd + down key is pressed, output the next element if (currentIndex < historyRef.current.length - 1) { setCurrentIndex(currentIndex + 1) setQuery(historyRef.current[currentIndex + 1]) } else if (currentIndex === historyRef.current.length - 1) { - // If it is the last element, clear the input box + // If it is the last element, clear the input box setCurrentIndex(historyRef.current.length) setQuery('') }