Skip to content

Commit 3750200

Browse files
authored
feat: add a meta(mac) ctrl(windows) key (#10978)
1 parent c5f7d65 commit 3750200

File tree

1 file changed

+5
-5
lines changed
  • web/app/components/base/chat/chat/chat-input-area

1 file changed

+5
-5
lines changed

web/app/components/base/chat/chat/chat-input-area/index.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -102,21 +102,21 @@ const ChatInputArea = ({
102102
setCurrentIndex(historyRef.current.length)
103103
handleSend()
104104
}
105-
else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing) {
106-
// When the up key is pressed, output the previous element
105+
else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) {
106+
// When the cmd + up key is pressed, output the previous element
107107
if (currentIndex > 0) {
108108
setCurrentIndex(currentIndex - 1)
109109
setQuery(historyRef.current[currentIndex - 1])
110110
}
111111
}
112-
else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing) {
113-
// When the down key is pressed, output the next element
112+
else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) {
113+
// When the cmd + down key is pressed, output the next element
114114
if (currentIndex < historyRef.current.length - 1) {
115115
setCurrentIndex(currentIndex + 1)
116116
setQuery(historyRef.current[currentIndex + 1])
117117
}
118118
else if (currentIndex === historyRef.current.length - 1) {
119-
// If it is the last element, clear the input box
119+
// If it is the last element, clear the input box
120120
setCurrentIndex(historyRef.current.length)
121121
setQuery('')
122122
}

0 commit comments

Comments
 (0)