Skip to content

Commit c315e05

Browse files
committed
🐛 Fix srcdoc failing on the preview
1 parent d66e7ce commit c315e05

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/components/preview.tsx

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
1-
import { Component, createEffect, createSignal, splitProps, JSX, For, Show } from 'solid-js';
1+
import {
2+
Component,
3+
createEffect,
4+
createSignal,
5+
splitProps,
6+
JSX,
7+
For,
8+
Show,
9+
onMount,
10+
} from 'solid-js';
211
import { Icon } from '@amoutonbrady/solid-heroicons';
312
import { chevronDown, chevronRight } from '@amoutonbrady/solid-heroicons/solid';
413
import useZoom from '../hooks/useZoom';
@@ -181,6 +190,10 @@ export const Preview: Component<Props> = (props) => {
181190
}); transform-origin: 0 0;`;
182191
};
183192

193+
onMount(() => {
194+
iframe.srcdoc = html;
195+
});
196+
184197
return (
185198
<div
186199
class={`grid relative ${internal.class}`}
@@ -191,7 +204,6 @@ export const Preview: Component<Props> = (props) => {
191204
title="Solid REPL"
192205
class="overflow-auto p-2 w-full h-full dark:bg-other"
193206
ref={iframe}
194-
srcdoc={html}
195207
onLoad={attachToIframe}
196208
// @ts-ignore
197209
sandbox="allow-popups-to-escape-sandbox allow-scripts allow-popups allow-forms allow-pointer-lock allow-top-navigation allow-modals allow-same-origin"

0 commit comments

Comments
 (0)