From bca59fa6ececd1d351945c3fe98cc4d8f12d74d2 Mon Sep 17 00:00:00 2001 From: moonrailgun Date: Tue, 29 Nov 2022 17:37:47 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=B0=83=E6=95=B4topic=E7=BB=86?= =?UTF-8?q?=E8=8A=82=EF=BC=8C=E5=A2=9E=E5=8A=A0=E5=AF=B9markdown=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=E7=9A=84=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/github-app/src/app.ts | 10 +++++----- .../com.msgbyte.bbcode/src/tags/__all__.ts | 1 + client/web/src/components/Markdown.tsx | 1 + client/web/tailchat.d.ts | 18 +++++++++++++----- 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/apps/github-app/src/app.ts b/apps/github-app/src/app.ts index 1e79b0c8..d268b32d 100644 --- a/apps/github-app/src/app.ts +++ b/apps/github-app/src/app.ts @@ -54,11 +54,11 @@ export function app(app: Probot) { panelId, content: `[b]${ ctx.payload.issue.user.login - }[/b] create Issue:\n\nTitle: ${ctx.payload.issue.title}\nContent: ${ + }[/b] create Issue:\n\nTitle: ${ctx.payload.issue.title}\n[markdown]${ ctx.payload.issue.body ?? '' - }\n\nWebsite: ${ctx.payload.issue.html_url}`, + }[/markdown]\n\nWebsite: ${ctx.payload.issue.html_url}`, meta: { - githubRepoOwner: ctx.payload.repository.owner, + githubRepoOwner: ctx.payload.repository.owner.login, githubRepoName: ctx.payload.repository.name, githubIssueNumber: ctx.payload.issue.number, }, @@ -130,9 +130,9 @@ export function app(app: Probot) { topicId, content: `[b]${ ctx.payload.comment.user.login - }[/b] reply Issue:\n\nContent: ${ + }[/b] reply Issue:\n\n[markdown]${ ctx.payload.comment.body ?? '' - }\n\nWebsite: ${ctx.payload.comment.html_url}`, + }[/markdown]\n\nWebsite: ${ctx.payload.comment.html_url}`, }); } catch (err) { console.error(err); diff --git a/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts b/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts index 9e51fc98..eb71f9f9 100644 --- a/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts +++ b/client/web/plugins/com.msgbyte.bbcode/src/tags/__all__.ts @@ -27,3 +27,4 @@ registerBBCodeTag('code', CodeTag); registerBBCodeTag('at', MentionTag); registerBBCodeTag('emoji', EmojiTag); registerBBCodeTag('markdown', MarkdownTag); +registerBBCodeTag('md', MarkdownTag); // alias diff --git a/client/web/src/components/Markdown.tsx b/client/web/src/components/Markdown.tsx index d0a6b8f6..2d06506b 100644 --- a/client/web/src/components/Markdown.tsx +++ b/client/web/src/components/Markdown.tsx @@ -28,6 +28,7 @@ export const Markdown: React.FC<{ className="tailchat-markdown" transformImageUri={(src) => transformUrl(src)} transformLinkUri={(href) => transformUrl(href)} + skipHtml={true} > {raw} diff --git a/client/web/tailchat.d.ts b/client/web/tailchat.d.ts index 1ab8bc10..f2770cfd 100644 --- a/client/web/tailchat.d.ts +++ b/client/web/tailchat.d.ts @@ -183,13 +183,21 @@ declare module '@capital/common' { export const regGroupPanel: any; - export const messageInterpreter: any; - - export const regMessageInterpreter: any; + export const messageInterpreter: { + name?: string; + explainMessage: (message: string) => React.ReactNode; + }[]; + + export const regMessageInterpreter: (interpreter: { + name?: string; + explainMessage: (message: string) => React.ReactNode; + }) => void; - export const getMessageRender: any; + export const getMessageRender: (message: string) => React.ReactNode; - export const regMessageRender: any; + export const regMessageRender: ( + render: (message: string) => React.ReactNode + ) => void; export const getMessageTextDecorators: any;