yuto-oweseek 4 лет назад
Родитель
Сommit
3f7acd422a

+ 1 - 4
packages/app/src/components/PageComment.tsx

@@ -37,7 +37,7 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
 
   const { data: comments, mutate } = useSWRxPageComment(pageId);
 
-  const [commentToBeDeleted, setCommentToBeDeleted] = useState<null | ICommentHasId>(null);
+  const [commentToBeDeleted, setCommentToBeDeleted] = useState<ICommentHasId | null>(null);
   const [isDeleteConfirmModalShown, setIsDeleteConfirmModalShown] = useState<boolean>(false);
   const [showEditorIds, setShowEditorIds] = useState<Set<string>>(new Set());
   const [formatedComments, setFormatedComments] = useState<ICommentHasIdList | null>(null);
@@ -65,7 +65,6 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
     if (comments != null) {
       const preprocessedCommentList: string[] = comments.map((comment) => {
         const highlightedComment: string = highlightComment(comment.comment);
-
         return highlightedComment;
       });
       const preprocessedComments: ICommentHasIdList = comments.map((comment, index) => {
@@ -74,7 +73,6 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
       setFormatedComments(preprocessedComments);
     }
 
-
   }, [comments, highlightComment]);
 
   if (commentsFromOldest != null) {
@@ -111,7 +109,6 @@ const PageComment:FC<Props> = memo((props:Props):JSX.Element => {
     }
   }, [appContainer, commentToBeDeleted, onDeleteCommentAfterOperation]);
 
-
   const generateCommentInnerElement = (comment: ICommentHasId) => (
     <Comment
       growiRenderer={appContainer.getRenderer('comment')}

+ 4 - 2
packages/app/src/components/PageComment/Comment.jsx

@@ -147,7 +147,9 @@ class Comment extends React.PureComponent {
   }
 
   render() {
-    const { t, comment, isReadOnly } = this.props;
+    const {
+      t, comment, isReadOnly, onComment,
+    } = this.props;
     const commentId = comment._id;
     const creator = comment.creator;
     const isMarkdown = comment.isMarkdown;
@@ -176,7 +178,7 @@ class Comment extends React.PureComponent {
             onCancelButtonClicked={() => this.setState({ isReEdit: false })}
             onCommentButtonClicked={() => {
               this.setState({ isReEdit: false });
-              if (this.props.onComment != null) this.props.onComment();
+              if (onComment != null) onComment();
             }}
           />
         ) : (