@@ -10,6 +10,7 @@ import PreviewFrame from '../components/PreviewFrame';
10
10
import Console from '../components/Console' ;
11
11
import Toast from '../components/Toast' ;
12
12
import { updateFileContent } from '../actions/files' ;
13
+ import { ConsoleProvider } from '../context/ConsoleContext' ;
13
14
14
15
import {
15
16
autosaveProject ,
@@ -167,127 +168,130 @@ const IDEView = () => {
167
168
: consoleCollapsedSize ;
168
169
169
170
return (
170
- < RootPage >
171
- < Helmet >
172
- < title > { getTitle ( project ) } </ title >
173
- </ Helmet >
174
- < IDEKeyHandlers getContent = { ( ) => cmRef . current ?. getContent ( ) } />
175
- < WarnIfUnsavedChanges />
176
- < Toast />
177
- < P5VersionProvider >
178
- < CmControllerContext . Provider value = { cmRef } >
179
- < Header syncFileContent = { syncFileContent } />
180
- </ CmControllerContext . Provider >
181
- { isMobile ? (
182
- < >
183
- < FloatingActionButton
184
- syncFileContent = { syncFileContent }
185
- offsetBottom = { ide . isPlaying ? currentConsoleSize : 0 }
186
- />
187
- < PreviewWrapper show = { ide . isPlaying } >
188
- < SplitPane
189
- style = { { position : 'static' } }
190
- split = "horizontal"
191
- primary = "second"
192
- size = { currentConsoleSize }
193
- minSize = { consoleCollapsedSize }
194
- onChange = { ( size ) => {
195
- setConsoleSize ( size ) ;
196
- setIsOverlayVisible ( true ) ;
197
- } }
198
- onDragFinished = { ( ) => {
199
- setIsOverlayVisible ( false ) ;
200
- } }
201
- allowResize = { ide . consoleIsExpanded }
202
- className = "editor-preview-subpanel"
203
- >
204
- < PreviewFrame
205
- fullView
206
- hide = { ! ide . isPlaying }
207
- cmController = { cmRef . current }
208
- isOverlayVisible = { isOverlayVisible }
209
- />
210
- < Console />
211
- </ SplitPane >
212
- </ PreviewWrapper >
213
- < EditorSidebarWrapper show = { ! ide . isPlaying } >
214
- < Sidebar />
215
- < Editor
216
- provideController = { ( ctl ) => {
217
- cmRef . current = ctl ;
218
- } }
171
+ < ConsoleProvider >
172
+ < RootPage >
173
+ < Helmet >
174
+ < title > { getTitle ( project ) } </ title >
175
+ </ Helmet >
176
+ < IDEKeyHandlers getContent = { ( ) => cmRef . current ?. getContent ( ) } />
177
+ < WarnIfUnsavedChanges />
178
+ < Toast />
179
+ < P5VersionProvider >
180
+ < CmControllerContext . Provider value = { cmRef } >
181
+ < Header syncFileContent = { syncFileContent } />
182
+ </ CmControllerContext . Provider >
183
+ { isMobile ? (
184
+ < >
185
+ < FloatingActionButton
186
+ syncFileContent = { syncFileContent }
187
+ offsetBottom = { ide . isPlaying ? currentConsoleSize : 0 }
219
188
/>
220
- </ EditorSidebarWrapper >
221
- </ >
222
- ) : (
223
- < main className = "editor-preview-container" >
224
- < SplitPane
225
- split = "vertical"
226
- size = { ide . sidebarIsExpanded ? sidebarSize : 20 }
227
- onChange = { ( size ) => {
228
- setSidebarSize ( size ) ;
229
- } }
230
- allowResize = { ide . sidebarIsExpanded }
231
- minSize = { 150 }
232
- >
233
- < Sidebar />
234
- < SplitPane
235
- split = "vertical"
236
- maxSize = { MaxSize * 0.965 }
237
- defaultSize = "50%"
238
- onChange = { ( ) => {
239
- setIsOverlayVisible ( true ) ;
240
- } }
241
- onDragFinished = { ( ) => {
242
- setIsOverlayVisible ( false ) ;
243
- } }
244
- resizerStyle = { {
245
- borderLeftWidth : '2px' ,
246
- borderRightWidth : '2px' ,
247
- width : '2px' ,
248
- margin : '0px 0px'
249
- } }
250
- >
189
+ < PreviewWrapper show = { ide . isPlaying } >
251
190
< SplitPane
191
+ style = { { position : 'static' } }
252
192
split = "horizontal"
253
193
primary = "second"
254
194
size = { currentConsoleSize }
255
195
minSize = { consoleCollapsedSize }
256
196
onChange = { ( size ) => {
257
197
setConsoleSize ( size ) ;
198
+ setIsOverlayVisible ( true ) ;
199
+ } }
200
+ onDragFinished = { ( ) => {
201
+ setIsOverlayVisible ( false ) ;
258
202
} }
259
203
allowResize = { ide . consoleIsExpanded }
260
204
className = "editor-preview-subpanel"
261
205
>
262
- < Editor
263
- provideController = { ( ctl ) => {
264
- cmRef . current = ctl ;
265
- } }
206
+ < PreviewFrame
207
+ fullView
208
+ hide = { ! ide . isPlaying }
209
+ cmController = { cmRef . current }
210
+ isOverlayVisible = { isOverlayVisible }
266
211
/>
267
212
< Console />
268
213
</ SplitPane >
269
- < section className = "preview-frame-holder" >
270
- < header className = "preview-frame__header" >
271
- < h2 className = "preview-frame__title" >
272
- { t ( 'Toolbar.Preview' ) }
273
- </ h2 >
274
- </ header >
275
- < div className = "preview-frame__content" >
276
- < PreviewFrame
277
- cmController = { cmRef . current }
278
- isOverlayVisible = { isOverlayVisible }
214
+ </ PreviewWrapper >
215
+ < EditorSidebarWrapper show = { ! ide . isPlaying } >
216
+ < Sidebar />
217
+ < Editor
218
+ provideController = { ( ctl ) => {
219
+ cmRef . current = ctl ;
220
+ } }
221
+ />
222
+ </ EditorSidebarWrapper >
223
+ </ >
224
+ ) : (
225
+ < main className = "editor-preview-container" >
226
+ < SplitPane
227
+ split = "vertical"
228
+ size = { ide . sidebarIsExpanded ? sidebarSize : 20 }
229
+ onChange = { ( size ) => {
230
+ setSidebarSize ( size ) ;
231
+ } }
232
+ allowResize = { ide . sidebarIsExpanded }
233
+ minSize = { 150 }
234
+ >
235
+ < Sidebar />
236
+ < SplitPane
237
+ split = "vertical"
238
+ maxSize = { MaxSize * 0.965 }
239
+ defaultSize = "50%"
240
+ onChange = { ( ) => {
241
+ setIsOverlayVisible ( true ) ;
242
+ } }
243
+ onDragFinished = { ( ) => {
244
+ setIsOverlayVisible ( false ) ;
245
+ } }
246
+ resizerStyle = { {
247
+ borderLeftWidth : '2px' ,
248
+ borderRightWidth : '2px' ,
249
+ width : '2px' ,
250
+ margin : '0px 0px'
251
+ } }
252
+ >
253
+ < SplitPane
254
+ split = "horizontal"
255
+ primary = "second"
256
+ size = { currentConsoleSize }
257
+ minSize = { consoleCollapsedSize }
258
+ onChange = { ( size ) => {
259
+ setConsoleSize ( size ) ;
260
+ } }
261
+ allowResize = { ide . consoleIsExpanded }
262
+ className = "editor-preview-subpanel"
263
+ >
264
+ < Editor
265
+ provideController = { ( ctl ) => {
266
+ cmRef . current = ctl ;
267
+ } }
279
268
/>
280
- </ div >
281
- </ section >
269
+ < Console />
270
+ </ SplitPane >
271
+ < section className = "preview-frame-holder" >
272
+ < header className = "preview-frame__header" >
273
+ < h2 className = "preview-frame__title" >
274
+ { t ( 'Toolbar.Preview' ) }
275
+ </ h2 >
276
+ </ header >
277
+ < div className = "preview-frame__content" >
278
+ < PreviewFrame
279
+ cmController = { cmRef . current }
280
+ isOverlayVisible = { isOverlayVisible }
281
+ />
282
+ </ div >
283
+ </ section >
284
+ </ SplitPane >
282
285
</ SplitPane >
283
- </ SplitPane >
284
- </ main >
285
- ) }
286
- < CmControllerContext . Provider value = { cmRef } >
287
- < IDEOverlays />
288
- </ CmControllerContext . Provider >
289
- </ P5VersionProvider >
290
- </ RootPage >
286
+ </ main >
287
+ ) }
288
+ < CmControllerContext . Provider value = { cmRef } >
289
+ < IDEOverlays />
290
+ </ CmControllerContext . Provider >
291
+ </ P5VersionProvider >
292
+ < Console />
293
+ </ RootPage >
294
+ </ ConsoleProvider >
291
295
) ;
292
296
} ;
293
297
0 commit comments