diff --git a/apps/comments-ui/src/components/Form.js b/apps/comments-ui/src/components/Form.js index 32cbd0ba24..0543c27f72 100644 --- a/apps/comments-ui/src/components/Form.js +++ b/apps/comments-ui/src/components/Form.js @@ -59,8 +59,6 @@ const Form = (props) => { .run(); }, [editor, props.isEdit]); - const focused = editor?.isFocused || !editor?.isEmpty; - const submitForm = async (event) => { event.preventDefault(); @@ -120,6 +118,7 @@ const Form = (props) => { const {comment, commentsCount} = props; const memberName = (props.isEdit ? comment.member.name : member.name); + const isFocused = editor?.isFocused || !editor?.isEmpty; const focusEditor = (event) => { event.stopPropagation(); @@ -129,13 +128,17 @@ const Form = (props) => { } else { setAddNameShowing(true); } - return false; }; const closeAddName = () => { setAddNameShowing(false); }; + const saveAddName = () => { + setAddNameShowing(false); + editor.commands.focus(); + }; + let submitText; if (props.isReply) { submitText = 'Add reply'; @@ -153,7 +156,7 @@ const Form = (props) => { bg-white dark:bg-[rgba(255,255,255,0.08)] rounded-md shadow-lg dark:shadow-transparent hover:shadow-xl ${!commentsCount && !props.isEdit && !props.isReply && '-mt-0 -mr-0 -ml-0'} - ${focused ? 'cursor-default' : 'cursor-pointer'}` + ${isFocused ? 'cursor-default' : 'cursor-pointer'}` }>