I'm trying to render the html created using the rich-text-editor(sun editor). But the min.css import is not getting applied to the dangerouslySetInnerHTML.
import { useLocation } from "react-router-dom"
import { blogDetailsType } from "./BlogForm"
import DOMPurify from "dompurify";
import 'suneditor/dist/css/suneditor.min.css';
// import SunEditor from 'suneditor-react';
const Preview = () => {
const location = useLocation()
const data: blogDetailsType = location?.state
const sanitizedHtml = DOMPurify.sanitize(data?.blog_html);
return (
<div className="tw:text-primary text-responsive-sm tw:py-4">
<div dangerouslySetInnerHTML={{__html:sanitizedHtml}}></div>
</div>
)
}
export default Preview
but the same styles are working to the <SunEditor/>
component though, also inline styles are working as usual in dangerouslySetInnerHTML.
I tried to set the min.css on the index.html but no luck.
<link rel="stylesheet" href=".min.css" />