diff --git a/_css/react.scss b/_css/react.scss index c502b06b..5e94c2fe 100644 --- a/_css/react.scss +++ b/_css/react.scss @@ -459,7 +459,7 @@ section.black content { } .playgroundPreview { - padding: 14px; + padding: 0; width: 600px; pre { diff --git a/_js/live_editor.js b/_js/live_editor.js index 818d3b4e..e03bde05 100644 --- a/_js/live_editor.js +++ b/_js/live_editor.js @@ -22,7 +22,8 @@ var CodeMirrorEditor = React.createClass({ mode: 'javascript', lineNumbers: false, matchBrackets: true, - theme: 'solarized-light' + theme: 'solarized-light', + readOnly: this.props.readOnly }); this.editor.on('change', this.onChange); this.onChange(); @@ -82,7 +83,7 @@ var ReactPlayground = React.createClass({ } else if (this.state.mode === this.MODES.JS) { content =
- {this.getDesugaredCode()} + {this.getDesugaredCode()}
; } @@ -111,13 +112,14 @@ var ReactPlayground = React.createClass({ } catch (e) { } try { + var desugaredCode = this.getDesugaredCode(); if (this.props.renderCode) { React.renderComponent( -
{this.getDesugaredCode()}
, + , mountNode ); } else { - eval(this.getDesugaredCode()); + eval(desugaredCode); } } catch (e) { React.renderComponent(