@@ -25,6 +25,7 @@ const Project = (props) => {
25
25
} = props ;
26
26
const saving = useSelector ( ( state ) => state . editor . saving ) ;
27
27
const autosave = useSelector ( ( state ) => state . editor . lastSaveAutosave ) ;
28
+ const project = useSelector ( ( state ) => state . editor . project ) ;
28
29
29
30
useEffect ( ( ) => {
30
31
if ( saving === "success" && autosave === false ) {
@@ -52,6 +53,9 @@ const Project = (props) => {
52
53
setLoading ( false ) ;
53
54
} , [ ] ) ;
54
55
56
+ const publicUrl = process . env . PUBLIC_URL ;
57
+ const iframeSrc = `${ publicUrl } /scratch-component.html` ;
58
+
55
59
return (
56
60
< div className = "proj" data-testid = "project" >
57
61
< div
@@ -64,18 +68,28 @@ const Project = (props) => {
64
68
{ withProjectbar && < ProjectBar nameEditable = { nameEditable } /> }
65
69
{ ! loading && (
66
70
< 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
+ ) }
79
93
</ div >
80
94
) }
81
95
</ div >
0 commit comments