diff --git a/components/AIAssist.tsx b/components/AIAssist.tsx index 8090f76..690c00d 100644 --- a/components/AIAssist.tsx +++ b/components/AIAssist.tsx @@ -52,15 +52,26 @@ const LiveCanvas = memo(({ data, type, isStreaming }: { data: string, type: stri : data; // Check if the content is a full HTML document or a fragment - const isFullDocument = normalized.trim().startsWith("]/i.test(normalized); let doc: string; if (isFullDocument) { // If it's a full document, inject Tailwind CSS but keep the structure - doc = normalized.replace(/
/i, ` - - - `); + if (hasHeadTag) { + doc = normalized.replace(//i, ` + + + `); + } else { + doc = normalized.replace(/]*>/i, (match) => `${match} + + + + + `); + } } else { // Wrap fragments in a styled container doc = ` @@ -117,8 +128,8 @@ const LiveCanvas = memo(({ data, type, isStreaming }: { data: string, type: stri sandbox="allow-scripts" /> {isStreaming && ( -