فهرست منبع

framework for switching commentBody based on isMarkdown

sou 8 سال پیش
والد
کامیت
de76baa03b
1فایلهای تغییر یافته به همراه2 افزوده شده و 2 حذف شده
  1. 2 2
      resource/js/components/PageComment/Comment.js

+ 2 - 2
resource/js/components/PageComment/Comment.js

@@ -51,15 +51,15 @@ export default class Comment extends React.Component {
   render() {
   render() {
     const comment = this.props.comment;
     const comment = this.props.comment;
     const creator = comment.creator;
     const creator = comment.creator;
+    const isMarkdown = comment.isMarkdown;
 
 
     // temporary from here
     // temporary from here
-    const isMarkdown = comment.isMarkdown;
     let markdownText = isMarkdown ? 'markdown' : 'plain';
     let markdownText = isMarkdown ? 'markdown' : 'plain';
     // to here
     // to here
 
 
     const rootClassName = this.getRootClassName();
     const rootClassName = this.getRootClassName();
     const commentDate = dateFnsFormat(comment.createdAt, 'YYYY/MM/DD HH:mm');
     const commentDate = dateFnsFormat(comment.createdAt, 'YYYY/MM/DD HH:mm');
-    const commentBody = ReactUtils.nl2br(comment.comment);
+    const commentBody = isMarkdown ? ReactUtils.nl2br(comment.comment) : ReactUtils.nl2br(comment.comment);
     const creatorsPage = `/user/${creator.username}`;
     const creatorsPage = `/user/${creator.username}`;
     const revHref = `?revision=${comment.revision}`;
     const revHref = `?revision=${comment.revision}`;
     const revFirst8Letters = comment.revision.substr(-8);
     const revFirst8Letters = comment.revision.substr(-8);