Просмотр исходного кода

Merge branch 'Re-edit-comment-for-master-merge' into create-api-for-re-edit

itizawa 6 лет назад
Родитель
Сommit
5bde631574

+ 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 - 9
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);
   }
 
@@ -337,8 +331,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,
 };