mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-12 12:09:03 +08:00
feat: add a meta(mac) ctrl(windows) key (#10978)
This commit is contained in:
parent
c5f7d650b5
commit
3750200c5e
@ -102,21 +102,21 @@ const ChatInputArea = ({
|
|||||||
setCurrentIndex(historyRef.current.length)
|
setCurrentIndex(historyRef.current.length)
|
||||||
handleSend()
|
handleSend()
|
||||||
}
|
}
|
||||||
else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
else if (e.key === 'ArrowUp' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) {
|
||||||
// When the up key is pressed, output the previous element
|
// When the cmd + up key is pressed, output the previous element
|
||||||
if (currentIndex > 0) {
|
if (currentIndex > 0) {
|
||||||
setCurrentIndex(currentIndex - 1)
|
setCurrentIndex(currentIndex - 1)
|
||||||
setQuery(historyRef.current[currentIndex - 1])
|
setQuery(historyRef.current[currentIndex - 1])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing) {
|
else if (e.key === 'ArrowDown' && !e.shiftKey && !e.nativeEvent.isComposing && e.metaKey) {
|
||||||
// When the down key is pressed, output the next element
|
// When the cmd + down key is pressed, output the next element
|
||||||
if (currentIndex < historyRef.current.length - 1) {
|
if (currentIndex < historyRef.current.length - 1) {
|
||||||
setCurrentIndex(currentIndex + 1)
|
setCurrentIndex(currentIndex + 1)
|
||||||
setQuery(historyRef.current[currentIndex + 1])
|
setQuery(historyRef.current[currentIndex + 1])
|
||||||
}
|
}
|
||||||
else if (currentIndex === historyRef.current.length - 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)
|
setCurrentIndex(historyRef.current.length)
|
||||||
setQuery('')
|
setQuery('')
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user