import type { CSSProperties } from "preact/compat"; type HTMLElementLike = string | HTMLElement | JQuery; interface RawHtmlProps { className?: string; html: HTMLElementLike; style?: CSSProperties; } export default function RawHtml(props: RawHtmlProps) { return ; } export function RawHtmlBlock(props: RawHtmlProps) { return
} function getProps({ className, html, style }: RawHtmlProps) { return { className: className, dangerouslySetInnerHTML: getHtml(html), style } } export function getHtml(html: string | HTMLElement | JQuery) { if (typeof html === "object" && "length" in html) { html = html[0]; } if (typeof html === "object" && "outerHTML" in html) { html = html.outerHTML; } return { __html: html as string }; }