Disable enter submit on mobile on group chat
This commit is contained in:
parent
490eabf977
commit
cc1431da60
|
@ -32,6 +32,7 @@ import { useEvent } from 'web/hooks/use-event'
|
||||||
import { Tipper } from '../tipper'
|
import { Tipper } from '../tipper'
|
||||||
import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns'
|
import { CommentTipMap, CommentTips } from 'web/hooks/use-tip-txns'
|
||||||
import useMediaQuery from 'react-query/types/devtools/useMediaQuery'
|
import useMediaQuery from 'react-query/types/devtools/useMediaQuery'
|
||||||
|
import { useWindowSize } from 'web/hooks/use-window-size'
|
||||||
|
|
||||||
export function FeedCommentThread(props: {
|
export function FeedCommentThread(props: {
|
||||||
contract: Contract
|
contract: Contract
|
||||||
|
@ -487,7 +488,7 @@ export function CommentInputTextArea(props: {
|
||||||
replyToUsername,
|
replyToUsername,
|
||||||
enterToSubmitOnDesktop,
|
enterToSubmitOnDesktop,
|
||||||
} = props
|
} = props
|
||||||
const isMobile = innerWidth < 768
|
const { width } = useWindowSize()
|
||||||
const memoizedSetComment = useEvent(setComment)
|
const memoizedSetComment = useEvent(setComment)
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!replyToUsername || !user || replyToUsername === user.username) return
|
if (!replyToUsername || !user || replyToUsername === user.username) return
|
||||||
|
@ -520,7 +521,8 @@ export function CommentInputTextArea(props: {
|
||||||
(enterToSubmitOnDesktop &&
|
(enterToSubmitOnDesktop &&
|
||||||
e.key === 'Enter' &&
|
e.key === 'Enter' &&
|
||||||
!e.shiftKey &&
|
!e.shiftKey &&
|
||||||
!isMobile) ||
|
width &&
|
||||||
|
width > 768) ||
|
||||||
(e.key === 'Enter' && (e.ctrlKey || e.metaKey))
|
(e.key === 'Enter' && (e.ctrlKey || e.metaKey))
|
||||||
) {
|
) {
|
||||||
e.preventDefault()
|
e.preventDefault()
|
||||||
|
|
Loading…
Reference in New Issue
Block a user