Sfoglia il codice sorgente

支持文章markdown渲染器

visuddhinanda 2 anni fa
parent
commit
89397678f4

+ 1 - 0
dashboard/src/components/api/Comment.ts

@@ -24,6 +24,7 @@ export interface ICommentApiData {
   title?: string;
   title?: string;
   content?: string;
   content?: string;
   content_type?: TContentType;
   content_type?: TContentType;
+  html?: string;
   parent?: string;
   parent?: string;
   tpl_id?: string;
   tpl_id?: string;
   status?: "active" | "close";
   status?: "active" | "close";

+ 1 - 0
dashboard/src/components/discussion/DiscussionItem.tsx

@@ -14,6 +14,7 @@ export interface IComment {
   parent?: string | null;
   parent?: string | null;
   title?: string;
   title?: string;
   content?: string;
   content?: string;
+  html?: string;
   status?: "active" | "close";
   status?: "active" | "close";
   children?: IComment[];
   children?: IComment[];
   childrenCount?: number;
   childrenCount?: number;

+ 2 - 1
dashboard/src/components/discussion/DiscussionShow.tsx

@@ -29,6 +29,7 @@ import { IDeleteResponse } from "../api/Article";
 import { fullUrl } from "../../utils";
 import { fullUrl } from "../../utils";
 import { ICommentRequest, ICommentResponse } from "../api/Comment";
 import { ICommentRequest, ICommentResponse } from "../api/Comment";
 import { useState } from "react";
 import { useState } from "react";
+import MdView from "../template/MdView";
 
 
 const { Text } = Typography;
 const { Text } = Typography;
 
 
@@ -254,7 +255,7 @@ const DiscussionShowWidget = ({
       }
       }
       style={{ width: "100%" }}
       style={{ width: "100%" }}
     >
     >
-      <Marked text={data.content} />
+      {data.html ? <MdView html={data.html} /> : <Marked text={data.content} />}
     </Card>
     </Card>
   );
   );
 };
 };

+ 1 - 0
dashboard/src/components/discussion/DiscussionTopicInfo.tsx

@@ -53,6 +53,7 @@ const DiscussionTopicInfoWidget = ({
             user: item.editor,
             user: item.editor,
             title: item.title,
             title: item.title,
             content: item.content,
             content: item.content,
+            html: item.html,
             status: item.status,
             status: item.status,
             childrenCount: item.children_count,
             childrenCount: item.children_count,
             createdAt: item.created_at,
             createdAt: item.created_at,