Yuki Takei 8 سال پیش
والد
کامیت
214a8f8ee2
2فایلهای تغییر یافته به همراه9 افزوده شده و 7 حذف شده
  1. 3 1
      resource/js/components/PageComment/DeleteCommentModal.js
  2. 6 6
      resource/js/components/ReactUtils.js

+ 3 - 1
resource/js/components/PageComment/DeleteCommentModal.js

@@ -23,7 +23,9 @@ export default class DeleteCommentModal extends React.Component {
 
 
     const comment = this.props.comment;
     const comment = this.props.comment;
     const commentDate = moment(comment.createdAt).format('YYYY/MM/DD HH:mm');
     const commentDate = moment(comment.createdAt).format('YYYY/MM/DD HH:mm');
-    let commentBody = comment.comment
+
+    // generate body
+    let commentBody = comment.comment;
     if (commentBody.length > 200) { // omit
     if (commentBody.length > 200) { // omit
       commentBody = commentBody.substr(0,200) + '...';
       commentBody = commentBody.substr(0,200) + '...';
     }
     }

+ 6 - 6
resource/js/components/ReactUtils.js

@@ -16,12 +16,12 @@ export default class ReactUtils {
   static nl2br(text) {
   static nl2br(text) {
     var regex = /(\n)/g
     var regex = /(\n)/g
     return text.split(regex).map(function (line) {
     return text.split(regex).map(function (line) {
-        if (line.match(regex)) {
-            return React.createElement('br', {key: Math.random().toString(10).substr(2, 10)})
-        }
-        else {
-            return line;
-        }
+      if (line.match(regex)) {
+        return React.createElement('br', {key: Math.random().toString(10).substr(2, 10)})
+      }
+      else {
+        return line;
+      }
     });
     });
   }
   }