소스 검색

feat: add a meta(mac) ctrl(windows) key (#10978)

tags/0.12.0
crazywoola 11 달 전
부모
커밋
3750200c5e
No account linked to committer's email address
1개의 변경된 파일5개의 추가작업 그리고 5개의 파일을 삭제
  1. 5
    5
      web/app/components/base/chat/chat/chat-input-area/index.tsx

+ 5
- 5
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('')
}

Loading…
취소
저장