mirror of
https://github.com/zadam/trilium.git
synced 2025-11-06 05:15:59 +01:00
feat(react/dialogs): port bulk actions
This commit is contained in:
@@ -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
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user