disable enter to submit for mobile

This commit is contained in:
Jing Hua 2023-03-30 16:55:53 +08:00
parent 5f73a68ce5
commit 5f7b445225

View file

@ -342,7 +342,12 @@ const EditView = ({
}; };
const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => { const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {
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; const enterToSubmit = useStore.getState().enterToSubmit;
if (sticky) { if (sticky) {
if ( if (