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

framework for switching commentBody based on isMarkdown

sou 8 лет назад
Родитель
Сommit
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() {
     const comment = this.props.comment;
     const creator = comment.creator;
+    const isMarkdown = comment.isMarkdown;
 
     // temporary from here
-    const isMarkdown = comment.isMarkdown;
     let markdownText = isMarkdown ? 'markdown' : 'plain';
     // to here
 
     const rootClassName = this.getRootClassName();
     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 revHref = `?revision=${comment.revision}`;
     const revFirst8Letters = comment.revision.substr(-8);