fix(translate): Improve Enter key detection in translation input #2861

This commit is contained in:
kangfenmao 2025-03-05 17:16:05 +08:00
parent a25f4e90dd
commit 70eb0a9187

View File

@ -140,7 +140,8 @@ const TranslatePage: FC = () => {
}, [])
const onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
if (e.key === 'Enter' && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
const isEnterPressed = e.keyCode == 13
if (isEnterPressed && !e.shiftKey && !e.ctrlKey && !e.metaKey) {
e.preventDefault()
onTranslate()
}