@@ -25,6 +25,7 @@ const Project = (props) => {
2525 } = props ;
2626 const saving = useSelector ( ( state ) => state . editor . saving ) ;
2727 const autosave = useSelector ( ( state ) => state . editor . lastSaveAutosave ) ;
28+ const project = useSelector ( ( state ) => state . editor . project ) ;
2829
2930 useEffect ( ( ) => {
3031 if ( saving === "success" && autosave === false ) {
@@ -52,6 +53,9 @@ const Project = (props) => {
5253 setLoading ( false ) ;
5354 } , [ ] ) ;
5455
56+ const publicUrl = process . env . PUBLIC_URL ;
57+ const iframeSrc = `${ publicUrl } /scratch-component.html` ;
58+
5559 return (
5660 < div className = "proj" data-testid = "project" >
5761 < div
@@ -64,18 +68,28 @@ const Project = (props) => {
6468 { withProjectbar && < ProjectBar nameEditable = { nameEditable } /> }
6569 { ! loading && (
6670 < div className = "proj-editor-wrapper" >
67- < ResizableWithHandle
68- data-testid = "proj-editor-container"
69- className = "proj-editor-container"
70- defaultWidth = { defaultWidth }
71- defaultHeight = { defaultHeight }
72- handleDirection = { handleDirection }
73- minWidth = "25%"
74- maxWidth = { maxWidth }
75- >
76- < EditorInput />
77- </ ResizableWithHandle >
78- < Output />
71+ { project . project_type === "scratch" ? (
72+ < iframe
73+ src = { iframeSrc }
74+ style = { { width : "100%" , border : "0px" } }
75+ title = "scratch"
76+ > </ iframe >
77+ ) : (
78+ < >
79+ < ResizableWithHandle
80+ data-testid = "proj-editor-container"
81+ className = "proj-editor-container"
82+ defaultWidth = { defaultWidth }
83+ defaultHeight = { defaultHeight }
84+ handleDirection = { handleDirection }
85+ minWidth = "25%"
86+ maxWidth = { maxWidth }
87+ >
88+ < EditorInput />
89+ </ ResizableWithHandle >
90+ < Output />
91+ </ >
92+ ) }
7993 </ div >
8094 ) }
8195 </ div >
0 commit comments