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

Merge pull request #1506 from visuddhinanda/agile

讨论支持文章markdown渲染器
visuddhinanda 2 лет назад
Родитель
Сommit
9eb628858a

+ 26 - 0
dashboard/src/assets/icon/index.tsx

@@ -331,6 +331,28 @@ const TemplateOutLined = () => (
     ></path>
   </svg>
 );
+
+const CommentOutLined = () => (
+  <svg
+    viewBox="0 0 1024 1024"
+    version="1.1"
+    xmlns="http://www.w3.org/2000/svg"
+    p-id="4118"
+    width="1em"
+    height="1em"
+  >
+    <path
+      d="M901.12 173.056H136.192c-35.84 0-64.512 28.672-64.512 64.512v518.144c0 35.84 28.672 64.512 64.512 64.512h52.224v40.96c0 25.6 20.48 46.08 46.08 46.08h2.048c9.216 0 31.744-2.048 50.176-24.576l57.344-62.464H901.12c35.84 0 64.512-28.672 64.512-64.512V237.568c0-35.84-28.672-64.512-64.512-64.512z m7.168 582.656c0 4.096-3.072 7.168-7.168 7.168H331.776c-8.192 0-15.36 3.072-21.504 9.216L245.76 842.752v-51.2c0-15.36-13.312-28.672-28.672-28.672h-80.896c-4.096 0-7.168-3.072-7.168-7.168V237.568c0-4.096 3.072-7.168 7.168-7.168H901.12c4.096 0 7.168 3.072 7.168 7.168v518.144z"
+      fill="currentColor"
+      p-id="4119"
+    ></path>
+    <path
+      d="M238.592 375.808h243.712c14.336 0 26.624-12.288 26.624-26.624s-12.288-26.624-26.624-26.624H238.592c-14.336 0-26.624 12.288-26.624 26.624s12.288 26.624 26.624 26.624zM630.784 440.32H238.592c-14.336 0-26.624 12.288-26.624 26.624 0 14.336 12.288 26.624 26.624 26.624h392.192c14.336 0 26.624-12.288 26.624-26.624 0-14.336-11.264-26.624-26.624-26.624z"
+      fill="currentColor"
+      p-id="4120"
+    ></path>
+  </svg>
+);
 export const DictIcon = (props: Partial<CustomIconComponentProps>) => (
   <Icon component={DictSvg} {...props} />
 );
@@ -396,3 +418,7 @@ export const ThemeOutlinedIcon = (props: Partial<CustomIconComponentProps>) => (
 export const TemplateOutlinedIcon = (
   props: Partial<CustomIconComponentProps>
 ) => <Icon component={TemplateOutLined} {...props} />;
+
+export const CommentOutlinedIcon = (
+  props: Partial<CustomIconComponentProps>
+) => <Icon component={CommentOutLined} {...props} />;

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

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

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

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

+ 1 - 1
dashboard/src/components/discussion/DiscussionListCard.tsx

@@ -163,7 +163,7 @@ const DiscussionListCardWidget = ({
                 studioName = sentInfo.data.studio.realName;
                 break;
             }
-            const urlTpl = `/v2/article?view=studio&name=${studioName}&subtitle=_template_discussion_topic_&content=true`;
+            const urlTpl = `/v2/article?view=template&studio_name=${studioName}&subtitle=_template_discussion_topic_&content=true`;
             const resTpl = await get<IArticleListResponse>(urlTpl);
             if (resTpl.ok) {
               console.log("resTpl.data.rows", resTpl.data.rows);

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

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

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

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