import React, { CSSProperties, useMemo } from 'react'; import { useNode, UserComponent } from '@craftjs/core'; import DOMPurify from 'dompurify'; interface HtmlBlockProps { code: string; style?: CSSProperties; aiName?: string; node_id?: string; } const PURIFY_CONFIG = { ALLOWED_TAGS: [ 'a','p','br','hr','div','span','section','article', 'header','footer','main','aside','nav', 'ul','ol','li', 'h1','h2','h3','h4','h5','h6', 'em','strong','b','i','u','s', 'blockquote','code','pre', 'img','figure','figcaption', 'iframe', ], ALLOWED_ATTR: [ 'href','src','alt','title','target','rel', 'width','height','class', 'allowfullscreen','allow','frameborder', 'sandbox','referrerpolicy', ], ALLOWED_URI_REGEXP: /^(?:(?:https?|mailto|tel|data:image\/[a-z]+;base64,):|[^a-z]|[a-z+.-]+(?:[^a-z+.\-:]|$))/i, FORBID_TAGS: ['script','style','object','embed','link','meta','form','input','button','select','textarea'], FORBID_ATTR: [/^on/i], }; // M-6: `