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 {
201201 this . addLoopProtect ( sketchDoc ) ;
202202 sketchDoc . head . insertBefore ( consoleErrorsScript , sketchDoc . head . firstElement ) ;
203203
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+
204210 return `<!DOCTYPE HTML>\n${ sketchDoc . documentElement . outerHTML } ` ;
205211 }
206212
@@ -331,6 +337,7 @@ class PreviewFrame extends React.Component {
331337 if ( this . props . endSketchRefresh ) {
332338 this . props . endSketchRefresh ( ) ;
333339 }
340+ // debugger; // eslint-disable-line
334341 } else {
335342 doc . srcdoc = '' ;
336343 srcDoc . set ( doc , ' ' ) ;
@@ -384,11 +391,13 @@ PreviewFrame.propTypes = {
384391 clearConsole : PropTypes . func . isRequired ,
385392 cmController : PropTypes . shape ( {
386393 getContent : PropTypes . func
387- } )
394+ } ) ,
395+ forceFullWidth : PropTypes . bool
388396} ;
389397
390398PreviewFrame . defaultProps = {
391399 fullView : false ,
400+ forceFullWidth : false ,
392401 cmController : { }
393402} ;
394403
Original file line number Diff line number Diff line change 11/* eslint-disable */
2- import React from 'react' ;
2+ import React , { useEffect } from 'react' ;
33import PropTypes from 'prop-types' ;
44import { Link } from 'react-router' ;
55import { bindActionCreators } from 'redux' ;
@@ -53,10 +53,10 @@ const MobileSketchView = (props) => {
5353
5454 const { preferences, ide } = props ;
5555
56- // useEffect(() => {
56+ useEffect ( ( ) => {
5757 // console.log(params);
5858 // getProject(params.project_id, params.username);
59- // }, [] );
59+ } ) ;
6060
6161 return (
6262 < Screen >
@@ -78,6 +78,7 @@ const MobileSketchView = (props) => {
7878 content = { selectedFile . content }
7979
8080 isPlaying
81+ forceFullWidth
8182 isAccessibleOutputPlaying = { ide . isAccessibleOutputPlaying }
8283 previewIsRefreshing = { ide . previewIsRefreshing }
8384
You can’t perform that action at this time.
0 commit comments