mirror of
https://github.com/reactjs/react.dev.git
synced 2026-02-23 20:23:08 +00:00
make docs jsx compiler highlight transpiled js code
This commit is contained in:
@@ -459,7 +459,7 @@ section.black content {
|
||||
}
|
||||
|
||||
.playgroundPreview {
|
||||
padding: 14px;
|
||||
padding: 0;
|
||||
width: 600px;
|
||||
|
||||
pre {
|
||||
|
||||
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user