diff --git a/src/components/CommentInput.tsx b/src/components/CommentInput.tsx index b147ad6..5b16441 100644 --- a/src/components/CommentInput.tsx +++ b/src/components/CommentInput.tsx @@ -71,7 +71,7 @@ const BoardCommentInput = (props: PropsType) => { if (e.keyCode === 13 && !e.shiftKey) { e.preventDefault() - if (props.type !== 'add' && e.currentTarget.value.replace(/ /g, '').length !== 0) { + if (props.type !== 'add' && e.currentTarget.value.replace(/\n/g, '').replace(/\s/g, '').length !== 0) { try { postComment(props.boardId, e.currentTarget.value, props.commentId) dispatch(setCommentInput({ commentNum: -1 })) @@ -84,9 +84,9 @@ const BoardCommentInput = (props: PropsType) => { }) } e.currentTarget.value = '' - } else if (e.currentTarget.value.replace(/ /g, '').length !== 0) { + } else if (e.currentTarget.value.replace(/\n/g, '').replace(/\s/g, '').length !== 0) { addCommentFn() - } else if (e.currentTarget.value.replace(/ /g, '').length === 0) { + } else if (e.currentTarget.value.replace(/\n/g, '').replace(/\s/g, '').length === 0) { openModal({ isModalOpen: true, isConfirm: false, @@ -107,7 +107,7 @@ const BoardCommentInput = (props: PropsType) => { className="add_comment_btn" onClick={() => { const comment = commentValue.current as HTMLTextAreaElement - if (comment.value.replace(/ /g, '') !== '') { + if (comment.value.replace(/\n/g, '').replace(/\s/g, '').length !== 0) { addCommentFn() } else { openModal({ @@ -163,6 +163,10 @@ const InputEl = styled.div` padding-left: 15px; padding-right: 50px; resize: none; + + &::-webkit-scrollbar { + display: none; + } } & > button,