From b0e7bb41110e961e6be0f76655a7de1a80e1eabf Mon Sep 17 00:00:00 2001 From: Puyodead1 Date: Sat, 9 Dec 2023 16:18:06 -0500 Subject: [PATCH] everyone and here mention rendering --- src/components/markdown/MarkdownRenderer.tsx | 4 ++++ src/components/markdown/Mention.tsx | 11 ++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/components/markdown/MarkdownRenderer.tsx b/src/components/markdown/MarkdownRenderer.tsx index 704c467..e5925d5 100644 --- a/src/components/markdown/MarkdownRenderer.tsx +++ b/src/components/markdown/MarkdownRenderer.tsx @@ -176,6 +176,10 @@ const customRenderer: Partial = { )); + replaced = reactStringReplace(replaced, /(@everyone|@here)/, (match, i) => ( + + )); + return replaced; }, }; diff --git a/src/components/markdown/Mention.tsx b/src/components/markdown/Mention.tsx index 742240f..8411227 100644 --- a/src/components/markdown/Mention.tsx +++ b/src/components/markdown/Mention.tsx @@ -125,8 +125,16 @@ function RoleMention({ id }: MentionProps) { ); } +function CustomMention({ id }: MentionProps) { + return ( + + {id} + + ); +} + interface Props { - type: "role" | "user" | "channel"; + type: "role" | "user" | "channel" | "text"; id: string; } @@ -134,6 +142,7 @@ function Mention({ type, id }: Props) { if (type === "role") return ; if (type === "user") return ; if (type === "channel") return ; + if (type === "text") return ; return null; }