2025-08-05 20:35:53 +03:00
|
|
|
interface RawHtmlProps {
|
2025-08-06 18:38:52 +03:00
|
|
|
className?: string;
|
|
|
|
|
html: string | HTMLElement;
|
2025-08-05 20:35:53 +03:00
|
|
|
}
|
|
|
|
|
|
2025-08-06 18:38:52 +03:00
|
|
|
export default function RawHtml({ className, html }: RawHtmlProps) {
|
|
|
|
|
return <span
|
|
|
|
|
className={className}
|
|
|
|
|
dangerouslySetInnerHTML={getHtml(html)}
|
|
|
|
|
/>;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function RawHtmlBlock({ className, html }: RawHtmlProps) {
|
|
|
|
|
return <div
|
|
|
|
|
className={className}
|
|
|
|
|
dangerouslySetInnerHTML={getHtml(html)}
|
|
|
|
|
/>
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function getHtml(html: string | HTMLElement) {
|
|
|
|
|
if (typeof html !== "string") {
|
|
|
|
|
html = html.outerHTML;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return {
|
|
|
|
|
__html: html
|
|
|
|
|
};
|
2025-08-05 20:35:53 +03:00
|
|
|
}
|