langflow/src/frontend/src/components/common/sanitizedHTMLWrapper/index.tsx
Lucas Oliveira e15730173f
fix: update font size of prompt when validated (#5214)
Fixed prompt after validation not showing up correctly

Co-authored-by: Eric Hare <ericrhare@gmail.com>
2024-12-17 09:10:42 -08:00

26 lines
796 B
TypeScript

import { cn } from "@/utils/utils";
import DOMPurify from "dompurify";
import { forwardRef } from "react";
import { SanitizedHTMLWrapperType } from "../../../types/components";
const SanitizedHTMLWrapper = forwardRef<
HTMLDivElement,
React.HTMLAttributes<HTMLHeadingElement> & SanitizedHTMLWrapperType
>(({ content, suppressWarning = false, ...props }, ref) => {
const sanitizedHTML = DOMPurify.sanitize(content);
return (
<div
ref={ref}
data-testid="edit-prompt-sanitized"
dangerouslySetInnerHTML={{ __html: sanitizedHTML }}
suppressContentEditableWarning={suppressWarning}
{...props}
className={cn("m-1 w-full", props.className)}
/>
);
});
SanitizedHTMLWrapper.displayName = "SanitizedHTMLWrapper";
export default SanitizedHTMLWrapper;