Skip to content

Commit a2f9981

Browse files
committed
fix: handle playground mode as HTML mode in preview rendering
Playground mode was falling through to the CSS branch, wrapping user code in a <style> tag. This prevented HTML elements and font styles from rendering correctly. Now playground mode is treated like HTML mode, allowing templates with <style> blocks and HTML content to work properly. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
1 parent 50605e6 commit a2f9981

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/impl/LessonEngine.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ export class LessonEngine {
206206
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
207207
iframeDoc.open();
208208

209-
if (mode === "html") {
210-
// For HTML mode, user code IS the HTML content
209+
if (mode === "html" || mode === "playground") {
210+
// For HTML/playground mode, user code IS the HTML content (may include <style> blocks)
211211
const userHtml = this.userCode || "";
212212
iframeDoc.write(`
213213
<!DOCTYPE html>
@@ -301,8 +301,8 @@ export class LessonEngine {
301301
const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
302302
iframeDoc.open();
303303

304-
if (mode === "html") {
305-
// For HTML mode, solution code IS the HTML content
304+
if (mode === "html" || mode === "playground") {
305+
// For HTML/playground mode, solution code IS the HTML content
306306
iframeDoc.write(`
307307
<!DOCTYPE html>
308308
<html>

0 commit comments

Comments
 (0)