feat(react/dialogs): port bulk actions

This commit is contained in:
Elian Doran
2025-08-07 20:08:51 +03:00
parent 8d27a5aa39
commit f9eb0a20f7
6 changed files with 195 additions and 181 deletions

View File

@@ -1,28 +1,39 @@
import { CSSProperties } from "preact/compat";
type HTMLElementLike = string | HTMLElement | JQuery<HTMLElement>;
interface RawHtmlProps {
className?: string;
html: string | HTMLElement;
html: HTMLElementLike;
style?: CSSProperties;
}
export default function RawHtml({ className, html }: RawHtmlProps) {
export default function RawHtml({ className, html, style }: RawHtmlProps) {
return <span
className={className}
dangerouslySetInnerHTML={getHtml(html)}
style={style}
/>;
}
export function RawHtmlBlock({ className, html }: RawHtmlProps) {
export function RawHtmlBlock({ className, html, style }: RawHtmlProps) {
return <div
className={className}
dangerouslySetInnerHTML={getHtml(html)}
style={style}
/>
}
function getHtml(html: string | HTMLElement) {
if (typeof html !== "string") {
function getHtml(html: string | HTMLElement | JQuery<HTMLElement>) {
if (typeof html === "object" && "length" in html) {
html = html[0];
}
if (typeof html === "object" && "outerHTML" in html) {
html = html.outerHTML;
}
return {
__html: html
__html: html as string
};
}