Skip to content

Commit

Permalink
janky but its fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
SupertigerDev committed Sep 24, 2024
1 parent c755a95 commit a62f257
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/components/message-pane/message-item/MessageItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1244,6 +1244,14 @@ function HTMLEmbedItem(props: { items: HtmlEmbedItem[] | string[] }) {
return attributes;
};

const replaceEscaped = (str: string) => {
return str
.replaceAll("&", "&")
.replaceAll("&lt;", "<")
.replaceAll("&gt;", ">")
.replaceAll("&quot;", '"')
.replaceAll("&#039;", "'");
};
return (
<For each={props.items}>
{(item) => (
Expand All @@ -1264,7 +1272,9 @@ function HTMLEmbedItem(props: { items: HtmlEmbedItem[] | string[] }) {
}
>
<Match when={typeof content === "string"}>
<Markup text={content as string} />
<Markup
text={replaceEscaped(content as string) as string}
/>
</Match>
<Match when={(content as HtmlEmbedItem).tag === "style"}>
<></>
Expand All @@ -1276,7 +1286,7 @@ function HTMLEmbedItem(props: { items: HtmlEmbedItem[] | string[] }) {
}
>
<Match when={typeof item === "string"}>
<Markup text={item as string} />
<Markup text={replaceEscaped(item as string)} />
</Match>
<Match when={(item as HtmlEmbedItem).tag === "style"}>
<></>
Expand Down

0 comments on commit a62f257

Please sign in to comment.