only submit on enter in chat
This commit is contained in:
parent
f9ee5031fd
commit
18152ff655
|
@ -447,6 +447,7 @@ export function CommentInputTextArea(props: {
|
||||||
upload: any
|
upload: any
|
||||||
submitComment: (id?: string) => void
|
submitComment: (id?: string) => void
|
||||||
isSubmitting: boolean
|
isSubmitting: boolean
|
||||||
|
submitOnEnter?: boolean
|
||||||
presetId?: string
|
presetId?: string
|
||||||
}) {
|
}) {
|
||||||
const {
|
const {
|
||||||
|
@ -456,6 +457,7 @@ export function CommentInputTextArea(props: {
|
||||||
submitComment,
|
submitComment,
|
||||||
presetId,
|
presetId,
|
||||||
isSubmitting,
|
isSubmitting,
|
||||||
|
submitOnEnter,
|
||||||
replyToUser,
|
replyToUser,
|
||||||
} = props
|
} = props
|
||||||
const isMobile = (useWindowSize().width ?? 0) < 768 // TODO: base off input device (keybord vs touch)
|
const isMobile = (useWindowSize().width ?? 0) < 768 // TODO: base off input device (keybord vs touch)
|
||||||
|
@ -478,6 +480,7 @@ export function CommentInputTextArea(props: {
|
||||||
editorProps: {
|
editorProps: {
|
||||||
handleKeyDown: (view, event) => {
|
handleKeyDown: (view, event) => {
|
||||||
if (
|
if (
|
||||||
|
submitOnEnter &&
|
||||||
event.key === 'Enter' &&
|
event.key === 'Enter' &&
|
||||||
!event.shiftKey &&
|
!event.shiftKey &&
|
||||||
(!isMobile || event.ctrlKey || event.metaKey) &&
|
(!isMobile || event.ctrlKey || event.metaKey) &&
|
||||||
|
|
|
@ -162,6 +162,7 @@ export function GroupChat(props: {
|
||||||
replyToUser={replyToUser}
|
replyToUser={replyToUser}
|
||||||
submitComment={submitMessage}
|
submitComment={submitMessage}
|
||||||
isSubmitting={isSubmitting}
|
isSubmitting={isSubmitting}
|
||||||
|
submitOnEnter
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user