Spaces:
Paused
Paused
Commit
·
2c7c9ec
1
Parent(s):
bb95e27
Update app/editor/index.tsx
Browse files- app/editor/index.tsx +1 -11
app/editor/index.tsx
CHANGED
@@ -48,19 +48,9 @@ export default function Editor({ defaultValue }: { defaultValue: string }) {
|
|
48 |
}
|
49 |
}, [])
|
50 |
|
51 |
-
const handlePreview = () => {
|
52 |
-
const codeDiv = document.querySelector("#editor");
|
53 |
-
const codeText = codeDiv.textContent;
|
54 |
-
const encodedJs = encodeURIComponent(codeText);
|
55 |
-
const dataUri = "data:text/javascript;charset=utf-8," + encodedJs;
|
56 |
-
import(dataUri);
|
57 |
-
}
|
58 |
-
|
59 |
return (
|
60 |
<>
|
61 |
-
<div id="editor" ref={ref} style={{ height: "
|
62 |
-
<button onClick={() => handlePreview()}>preview</button>
|
63 |
-
<div id="root" />
|
64 |
</>
|
65 |
)
|
66 |
}
|
|
|
48 |
}
|
49 |
}, [])
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
return (
|
52 |
<>
|
53 |
+
<div id="editor" ref={ref} style={{ height: "100vh" }} />
|
|
|
|
|
54 |
</>
|
55 |
)
|
56 |
}
|