@@ -7,6 +7,7 @@ import { Section } from "@courselit/page-primitives";
77import { SandboxedEmbed } from "../../components" ;
88
99export default function Widget ( {
10+ id,
1011 settings : {
1112 contentType,
1213 content,
@@ -29,10 +30,8 @@ export default function Widget({
2930
3031 const formattedHeight = `${ height } px` ;
3132
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 ) ;
33+ // Check if content is "script" or "iframe" (not a direct URL)
34+ const isEmbedCode = contentType === "script" ;
3635
3736 const containerStyle =
3837 aspectRatio && aspectRatio !== "default"
@@ -41,7 +40,7 @@ export default function Widget({
4140 width : "100%" ,
4241 paddingTop : `calc(100% / (${ aspectRatio . split ( ":" ) [ 0 ] } / ${ aspectRatio . split ( ":" ) [ 1 ] } ))` ,
4342 } as React . CSSProperties )
44- : hasScript
43+ : isEmbedCode
4544 ? ( { } as React . CSSProperties )
4645 : ( { height : formattedHeight } as React . CSSProperties ) ;
4746
@@ -54,29 +53,21 @@ export default function Widget({
5453 width : "100%" ,
5554 height : "100%" ,
5655 } as React . CSSProperties )
57- : hasScript
56+ : isEmbedCode
5857 ? ( { } as React . CSSProperties )
5958 : ( { height : "100%" } as React . CSSProperties ) ;
6059
6160 const renderContent = ( ) => {
62- if ( hasScript ) {
63- // Content has actual script tags - use sandboxed embed
61+ if ( isEmbedCode ) {
62+ // Content is a script or iframe code - use sandboxed embed for dynamic height
6463 return (
6564 < 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- ) ;
8071 } else {
8172 // URL-based content
8273 return (
0 commit comments