Files
leocrm/frontend/src/components/comm/blocks/HtmlBlock.tsx
T

27 lines
551 B
TypeScript
Raw Normal View History

import React from 'react';
2026-07-25 21:03:46 +02:00
import DOMPurify from 'dompurify';
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;
}
const sanitized = DOMPurify.sanitize(rawHtml);
return (
<div
className="prose prose-sm max-w-none text-inherit"
dangerouslySetInnerHTML={{ __html: sanitized }}
/>
);
};
export default HtmlBlock;