make docs jsx compiler highlight transpiled js code

This commit is contained in:
Cheng Lou
2013-11-25 19:04:28 -05:00
parent aef97f1d76
commit 0e18bc2843
2 changed files with 7 additions and 5 deletions

View File

@@ -459,7 +459,7 @@ section.black content {
}
.playgroundPreview {
padding: 14px;
padding: 0;
width: 600px;
pre {

View File

@@ -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 =
<div className="playgroundJS playgroundStage">
{this.getDesugaredCode()}
{this.getDesugaredCode()}
</div>;
}
@@ -111,13 +112,14 @@ var ReactPlayground = React.createClass({
} catch (e) { }
try {
var desugaredCode = this.getDesugaredCode();
if (this.props.renderCode) {
React.renderComponent(
<pre>{this.getDesugaredCode()}</pre>,
<CodeMirrorEditor codeText={desugaredCode} readOnly={true} />,
mountNode
);
} else {
eval(this.getDesugaredCode());
eval(desugaredCode);
}
} catch (e) {
React.renderComponent(