feat(web): add safe rich text formatting for message rendering

This commit is contained in:
2026-03-08 09:56:37 +03:00
parent 7c4a5f990d
commit cc70394960
3 changed files with 35 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import type { Message, MessageReaction } from "../chat/types";
import { useAuthStore } from "../store/authStore";
import { useChatStore } from "../store/chatStore";
import { formatTime } from "../utils/format";
import { formatMessageHtml } from "../utils/formatMessage";
type ContextMenuState = {
x: number;
@@ -555,7 +556,7 @@ function renderContent(messageType: string, text: string | null) {
</a>
);
}
return <p className="whitespace-pre-wrap break-words">{text}</p>;
return <p className="whitespace-pre-wrap break-words" dangerouslySetInnerHTML={{ __html: formatMessageHtml(text) }} />;
}
function renderStatus(status: string | undefined): string {