فهرست منبع

update PageCommentList.tsx method

yuto-oweseek 4 سال پیش
والد
کامیت
c6756ea6e9
1فایلهای تغییر یافته به همراه3 افزوده شده و 1 حذف شده
  1. 3 1
      packages/app/src/components/PageCommentList.tsx

+ 3 - 1
packages/app/src/components/PageCommentList.tsx

@@ -94,8 +94,10 @@ const PageCommentList:FC<Props> = memo((props:Props):JSX.Element => {
   }
 
   const highlightComment = (comment: string):string => {
+    if (highlightKeywords == null) return comment;
+
     let highlightedComment = '';
-    highlightKeywords?.forEach((highlightKeyword) => {
+    highlightKeywords.forEach((highlightKeyword) => {
       highlightedComment = comment.replaceAll(highlightKeyword, '<em class="highlighted-keyword">$&</em>');
     });
     return highlightedComment;