only submit on enter in chat

This commit is contained in:
Sinclair Chen 2022-08-03 16:20:48 -07:00
parent f9ee5031fd
commit 18152ff655
2 changed files with 4 additions and 0 deletions

View File

@ -447,6 +447,7 @@ export function CommentInputTextArea(props: {
upload: any
submitComment: (id?: string) => void
isSubmitting: boolean
submitOnEnter?: boolean
presetId?: string
}) {
const {
@ -456,6 +457,7 @@ export function CommentInputTextArea(props: {
submitComment,
presetId,
isSubmitting,
submitOnEnter,
replyToUser,
} = props
const isMobile = (useWindowSize().width ?? 0) < 768 // TODO: base off input device (keybord vs touch)
@ -478,6 +480,7 @@ export function CommentInputTextArea(props: {
editorProps: {
handleKeyDown: (view, event) => {
if (
submitOnEnter &&
event.key === 'Enter' &&
!event.shiftKey &&
(!isMobile || event.ctrlKey || event.metaKey) &&

View File

@ -162,6 +162,7 @@ export function GroupChat(props: {
replyToUser={replyToUser}
submitComment={submitMessage}
isSubmitting={isSubmitting}
submitOnEnter
/>
</div>
</div>