File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,12 @@ class PreviewFrame extends React.Component {
201
201
this . addLoopProtect ( sketchDoc ) ;
202
202
sketchDoc . head . insertBefore ( consoleErrorsScript , sketchDoc . head . firstElement ) ;
203
203
204
+ if ( this . props . forceFullWidth ) {
205
+ const resizeScript = sketchDoc . createElement ( 'style' ) ;
206
+ resizeScript . innerHTML = '.p5Canvas { width: 100% !important; height: auto !important }' ;
207
+ sketchDoc . head . appendChild ( resizeScript ) ;
208
+ }
209
+
204
210
return `<!DOCTYPE HTML>\n${ sketchDoc . documentElement . outerHTML } ` ;
205
211
}
206
212
@@ -331,6 +337,7 @@ class PreviewFrame extends React.Component {
331
337
if ( this . props . endSketchRefresh ) {
332
338
this . props . endSketchRefresh ( ) ;
333
339
}
340
+ // debugger; // eslint-disable-line
334
341
} else {
335
342
doc . srcdoc = '' ;
336
343
srcDoc . set ( doc , ' ' ) ;
@@ -384,11 +391,13 @@ PreviewFrame.propTypes = {
384
391
clearConsole : PropTypes . func . isRequired ,
385
392
cmController : PropTypes . shape ( {
386
393
getContent : PropTypes . func
387
- } )
394
+ } ) ,
395
+ forceFullWidth : PropTypes . bool
388
396
} ;
389
397
390
398
PreviewFrame . defaultProps = {
391
399
fullView : false ,
400
+ forceFullWidth : false ,
392
401
cmController : { }
393
402
} ;
394
403
Original file line number Diff line number Diff line change 1
1
/* eslint-disable */
2
- import React from 'react' ;
2
+ import React , { useEffect } from 'react' ;
3
3
import PropTypes from 'prop-types' ;
4
4
import { Link } from 'react-router' ;
5
5
import { bindActionCreators } from 'redux' ;
@@ -53,10 +53,10 @@ const MobileSketchView = (props) => {
53
53
54
54
const { preferences, ide } = props ;
55
55
56
- // useEffect(() => {
56
+ useEffect ( ( ) => {
57
57
// console.log(params);
58
58
// getProject(params.project_id, params.username);
59
- // }, [] );
59
+ } ) ;
60
60
61
61
return (
62
62
< Screen >
@@ -78,6 +78,7 @@ const MobileSketchView = (props) => {
78
78
content = { selectedFile . content }
79
79
80
80
isPlaying
81
+ forceFullWidth
81
82
isAccessibleOutputPlaying = { ide . isAccessibleOutputPlaying }
82
83
previewIsRefreshing = { ide . previewIsRefreshing }
83
84
You can’t perform that action at this time.
0 commit comments