From e99dc7d2c901711adcd059425a53015b5d4de025 Mon Sep 17 00:00:00 2001 From: Fedor Katurov Date: Sun, 9 Jan 2022 20:52:17 +0700 Subject: [PATCH] added meta to comment form --- .../comment/LocalCommentFormTextarea/index.tsx | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/comment/LocalCommentFormTextarea/index.tsx b/src/components/comment/LocalCommentFormTextarea/index.tsx index 7ec9feb1..1c4d1e6f 100644 --- a/src/components/comment/LocalCommentFormTextarea/index.tsx +++ b/src/components/comment/LocalCommentFormTextarea/index.tsx @@ -1,4 +1,9 @@ -import React, { forwardRef, KeyboardEventHandler, TextareaHTMLAttributes, useCallback } from 'react'; +import React, { + forwardRef, + KeyboardEventHandler, + TextareaHTMLAttributes, + useCallback, +} from 'react'; import { Textarea } from '~/components/input/Textarea'; import { useCommentFormContext } from '~/hooks/comments/useCommentFormFormik'; import { useRandomPhrase } from '~/constants/phrases'; @@ -11,8 +16,8 @@ const LocalCommentFormTextarea = forwardRef(({ ...r const { values, handleChange, handleSubmit, isSubmitting } = useCommentFormContext(); const onKeyDown = useCallback>( - ({ ctrlKey, key }) => { - if (ctrlKey && key === 'Enter') handleSubmit(undefined); + ({ ctrlKey, key, metaKey }) => { + if ((ctrlKey || metaKey) && key === 'Enter') handleSubmit(undefined); }, [handleSubmit] );