From 0e18bc28438505d6a5e29466eafe464e5b586c5f Mon Sep 17 00:00:00 2001 From: Cheng Lou Date: Mon, 25 Nov 2013 19:04:28 -0500 Subject: [PATCH] make docs jsx compiler highlight transpiled js code --- _css/react.scss | 2 +- _js/live_editor.js | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) 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(