mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
fix(react/dialogs): some type errors
This commit is contained in:
@@ -1,7 +1,28 @@
|
||||
interface RawHtmlProps {
|
||||
html: string;
|
||||
className?: string;
|
||||
html: string | HTMLElement;
|
||||
}
|
||||
|
||||
export default function RawHtml({ html }: RawHtmlProps) {
|
||||
return <span dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user