itizawa 6 лет назад
Родитель
Сommit
9b6d091d7a

+ 1 - 2
src/client/js/components/PageComment/Comment.jsx

@@ -261,9 +261,8 @@ class Comment extends React.Component {
         {showReEditor ? (
           <CommentEditor
             growiRenderer={this.growiRenderer}
-            currentComment={comment}
+            currentCommentId={commentId}
             commentBody={comment.comment}
-            reEdit
             replyTo={undefined}
             commentButtonClickedHandler={this.commentButtonClickedHandler}
           />

+ 2 - 8
src/client/js/components/PageComment/CommentEditor.jsx

@@ -84,13 +84,7 @@ class CommentEditor extends React.Component {
   }
 
   toggleEditor() {
-    let targetId;
-    if (this.props.reEdit) {
-      targetId = this.props.currentComment._id;
-    }
-    else {
-      targetId = this.props.replyTo;
-    }
+    const targetId = this.props.replyTo || this.props.currentCommentId;
     this.props.commentButtonClickedHandler(targetId);
   }
 
@@ -330,7 +324,7 @@ CommentEditor.propTypes = {
   growiRenderer: PropTypes.instanceOf(GrowiRenderer).isRequired,
   replyTo: PropTypes.string,
   reEdit: PropTypes.bool,
-  currentComment: PropTypes.object,
+  currentCommentId: PropTypes.string,
   commentBody: PropTypes.string,
   commentButtonClickedHandler: PropTypes.func.isRequired,
 };