From 5f7b4452258f8ce474a07b5e486e590d4faadb45 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Thu, 30 Mar 2023 16:55:53 +0800 Subject: [PATCH] disable enter to submit for mobile --- src/components/Chat/ChatContent/Message/MessageContent.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/Chat/ChatContent/Message/MessageContent.tsx b/src/components/Chat/ChatContent/Message/MessageContent.tsx index 28755bc..2364b2e 100644 --- a/src/components/Chat/ChatContent/Message/MessageContent.tsx +++ b/src/components/Chat/ChatContent/Message/MessageContent.tsx @@ -342,7 +342,12 @@ const EditView = ({ }; const handleKeyDown = (e: React.KeyboardEvent) => { - if (e.key === 'Enter') { + const isMobile = + /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini|playbook|silk/i.test( + navigator.userAgent + ); + + if (e.key === 'Enter' && !isMobile) { const enterToSubmit = useStore.getState().enterToSubmit; if (sticky) { if (