@samitouri / QOS-React-2 / commits / 92ea31c7b7

make docs jsx compiler highlight transpiled js code

Cheng Lou committed Nov 25, 2013 at 19:04 UTC 92ea31c7b773237893e38a7c306ae4c546fc8d80
2 files changed +7 -5
docs/_css/react.scss
+1 -1
@@ -459,7 +459,7 @@ section.black content {
459 }
460
461 .playgroundPreview {
462 - padding: 14px;
462 + padding: 0;
463 width: 600px;
464
465 pre {
docs/_js/live_editor.js
+6 -4
@@ -22,7 +22,8 @@ var CodeMirrorEditor = React.createClass({
22 mode: 'javascript',
23 lineNumbers: false,
24 matchBrackets: true,
25 - theme: 'solarized-light'
25 + theme: 'solarized-light',
26 + readOnly: this.props.readOnly
27 });
28 this.editor.on('change', this.onChange);
29 this.onChange();
@@ -82,7 +83,7 @@ var ReactPlayground = React.createClass({
83 } else if (this.state.mode === this.MODES.JS) {
84 content =
85 <div className="playgroundJS playgroundStage">
85 - {this.getDesugaredCode()}
86 + {this.getDesugaredCode()}
87 </div>;
88 }
89
@@ -111,13 +112,14 @@ var ReactPlayground = React.createClass({
112 } catch (e) { }
113
114 try {
115 + var desugaredCode = this.getDesugaredCode();
116 if (this.props.renderCode) {
117 React.renderComponent(
116 - <pre>{this.getDesugaredCode()}</pre>,
118 + <CodeMirrorEditor codeText={desugaredCode} readOnly={true} />,
119 mountNode
120 );
121 } else {
120 - eval(this.getDesugaredCode());
122 + eval(desugaredCode);
123 }
124 } catch (e) {
125 React.renderComponent(