diff --git a/src/lib/components/common/FullHeightIframe.svelte b/src/lib/components/common/FullHeightIframe.svelte index b1257aec80..e1e0cb2c0d 100644 --- a/src/lib/components/common/FullHeightIframe.svelte +++ b/src/lib/components/common/FullHeightIframe.svelte @@ -47,7 +47,7 @@ iframeSrc = src as string; iframeDoc = null; } else { - iframeDoc = await processHtmlForAlpine(src as string); + iframeDoc = await processHtmlForDeps(src as string); iframeSrc = null; } }; @@ -74,32 +74,56 @@ 'x-id' ]; - async function processHtmlForAlpine(html: string): Promise { + async function processHtmlForDeps(html: string): Promise { if (!allowSameOrigin) return html; + const scriptTags: string[] = []; + + // --- Alpine.js detection & injection --- const hasAlpineDirectives = alpineDirectives.some((dir) => html.includes(dir)); - if (!hasAlpineDirectives) return html; - - try { - // Import Alpine and get its source code - // import alpineCode from './alpine.min.js?raw'; - const { default: alpineCode } = await import('alpinejs/dist/cdn.min.js?raw'); - const alpineBlob = new Blob([alpineCode], { type: 'text/javascript' }); - const alpineUrl = URL.createObjectURL(alpineBlob); - - // Create Alpine initialization script - const alpineTag = `