2026-07-22 01:22:15 +02:00
|
|
|
import React from 'react';
|
2026-07-25 21:03:46 +02:00
|
|
|
import DOMPurify from 'dompurify';
|
2026-07-22 01:22:15 +02:00
|
|
|
import type { MessageBlock } from '@/store/commStore';
|
|
|
|
|
|
|
|
|
|
interface HtmlBlockProps {
|
|
|
|
|
block: MessageBlock;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const HtmlBlock: React.FC<HtmlBlockProps> = ({ block }) => {
|
|
|
|
|
const rawHtml: string = block.block_data.html || '';
|
|
|
|
|
|
|
|
|
|
if (!rawHtml) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2026-08-16 01:30:02 +02:00
|
|
|
const sanitized = DOMPurify.sanitize(rawHtml);
|
2026-07-22 01:22:15 +02:00
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<div
|
|
|
|
|
className="prose prose-sm max-w-none text-inherit"
|
|
|
|
|
dangerouslySetInnerHTML={{ __html: sanitized }}
|
|
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default HtmlBlock;
|