migration wip
This commit is contained in:
@@ -89,8 +89,16 @@ export const ContentRenderer: React.FC<ContentRendererProps> = ({
|
||||
/**
|
||||
* Parse HTML string to React elements
|
||||
* This is a safe parser that only allows specific tags and attributes
|
||||
* Works in both server and client environments
|
||||
*/
|
||||
function parseHTMLToReact(html: string): React.ReactNode {
|
||||
// For server-side rendering, use a simple approach with dangerouslySetInnerHTML
|
||||
// The HTML has already been sanitized by processHTML, so it's safe
|
||||
if (typeof window === 'undefined') {
|
||||
return <div dangerouslySetInnerHTML={{ __html: html }} />;
|
||||
}
|
||||
|
||||
// Client-side: use DOMParser for proper parsing
|
||||
// Define allowed tags and their properties
|
||||
const allowedTags = {
|
||||
div: ['className', 'id', 'style'],
|
||||
|
||||
Reference in New Issue
Block a user