@@ -7,7 +7,6 @@ import { Section } from "@courselit/page-primitives";
77import { SandboxedEmbed } from "../../components" ;
88
99export default function Widget ( {
10- id,
1110 settings : {
1211 contentType,
1312 content,
@@ -30,8 +29,10 @@ export default function Widget({
3029
3130 const formattedHeight = `${ height } px` ;
3231
33- // Check if content is "script" or "iframe" (not a direct URL)
34- const isEmbedCode = contentType === "script" ;
32+ // Check if content is "script" type but only contains an iframe (no actual scripts)
33+ const hasScript = contentType === "script" && / < s c r i p t [ \s > ] / i. test ( content ) ;
34+ const isPureIframe =
35+ contentType === "script" && ! hasScript && / < i f r a m e [ \s > ] / i. test ( content ) ;
3536
3637 const containerStyle =
3738 aspectRatio && aspectRatio !== "default"
@@ -40,7 +41,7 @@ export default function Widget({
4041 width : "100%" ,
4142 paddingTop : `calc(100% / (${ aspectRatio . split ( ":" ) [ 0 ] } / ${ aspectRatio . split ( ":" ) [ 1 ] } ))` ,
4243 } as React . CSSProperties )
43- : isEmbedCode
44+ : hasScript
4445 ? ( { } as React . CSSProperties )
4546 : ( { height : formattedHeight } as React . CSSProperties ) ;
4647
@@ -53,21 +54,29 @@ export default function Widget({
5354 width : "100%" ,
5455 height : "100%" ,
5556 } as React . CSSProperties )
56- : isEmbedCode
57+ : hasScript
5758 ? ( { } as React . CSSProperties )
5859 : ( { height : "100%" } as React . CSSProperties ) ;
5960
6061 const renderContent = ( ) => {
61- if ( isEmbedCode ) {
62- // Content is a script or iframe code - use sandboxed embed for dynamic height
62+ if ( hasScript ) {
63+ // Content has actual script tags - use sandboxed embed
6364 return (
6465 < SandboxedEmbed
65- id = { id }
6666 content = { content }
6767 className = "w-full"
6868 style = { iframeStyle }
6969 />
7070 ) ;
71+ } else if ( isPureIframe ) {
72+ // Content is a pure iframe without scripts - render directly
73+ return (
74+ < div
75+ className = "w-full"
76+ style = { iframeStyle }
77+ dangerouslySetInnerHTML = { { __html : content } }
78+ />
79+ ) ;
7180 } else {
7281 // URL-based content
7382 return (
0 commit comments