mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Properly clear live editor on JSX compile failure
This commit is contained in:
@@ -115,11 +115,9 @@ var ReactPlayground = React.createClass({
|
|||||||
compiledCode = this.compileCode();
|
compiledCode = this.compileCode();
|
||||||
} catch (err) {}
|
} catch (err) {}
|
||||||
|
|
||||||
// we're creating both versions, to avoid the flicker when switching from
|
|
||||||
// one view to another when CodeMirror recompiles
|
|
||||||
var jsContent =
|
var jsContent =
|
||||||
<CodeMirrorEditor
|
<CodeMirrorEditor
|
||||||
style={{display: isJS ? 'inherit' : 'none'}}
|
key="js"
|
||||||
className="playgroundStage CodeMirror-readonly"
|
className="playgroundStage CodeMirror-readonly"
|
||||||
onChange={this.handleCodeChange}
|
onChange={this.handleCodeChange}
|
||||||
codeText={compiledCode}
|
codeText={compiledCode}
|
||||||
@@ -128,7 +126,7 @@ var ReactPlayground = React.createClass({
|
|||||||
|
|
||||||
var jsxContent =
|
var jsxContent =
|
||||||
<CodeMirrorEditor
|
<CodeMirrorEditor
|
||||||
style={{display: isJS ? 'none' : 'inherit'}}
|
key="jsx"
|
||||||
onChange={this.handleCodeChange}
|
onChange={this.handleCodeChange}
|
||||||
className="playgroundStage"
|
className="playgroundStage"
|
||||||
codeText={this.state.code}
|
codeText={this.state.code}
|
||||||
@@ -154,8 +152,7 @@ var ReactPlayground = React.createClass({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="playgroundCode">
|
<div className="playgroundCode">
|
||||||
{jsxContent}
|
{isJS ? jsContent : jsxContent}
|
||||||
{jsContent}
|
|
||||||
</div>
|
</div>
|
||||||
<div className="playgroundPreview">
|
<div className="playgroundPreview">
|
||||||
<div ref="mount" />
|
<div ref="mount" />
|
||||||
|
|||||||
Reference in New Issue
Block a user