Skip to content

Commit 38f3edd

Browse files
author
Rajat
committed
Revert "Scroll height fix"
This reverts commit e385f39.
1 parent e385f39 commit 38f3edd

File tree

2 files changed

+10
-20
lines changed

2 files changed

+10
-20
lines changed

packages/page-blocks/src/blocks/embed/widget.tsx

Lines changed: 8 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { Section } from "@courselit/page-primitives";
77
import { SandboxedEmbed } from "../../components";
88

99
export 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" && /<script[\s>]/i.test(content);
34-
const isPureIframe =
35-
contentType === "script" && !hasScript && /<iframe[\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 (

packages/page-blocks/src/components/sandboxed-embed.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ export const SandboxedEmbed = ({
3838
<html>
3939
<head>
4040
<style>
41-
html, body { margin: 0; padding: 0; overflow: hidden; }
42-
#content-wrapper { overflow: hidden; height: auto; }
41+
html, body { margin: 0; padding: 0; height: auto; min-height: 100%; }
42+
#content-wrapper { overflow: auto; height: auto; }
4343
</style>
4444
</head>
4545
<body>
@@ -91,7 +91,6 @@ export const SandboxedEmbed = ({
9191
width: "100%",
9292
height: height,
9393
border: "none",
94-
overflow: "hidden",
9594
...style,
9695
}}
9796
sandbox="allow-scripts allow-popups allow-forms allow-same-origin"

0 commit comments

Comments
 (0)