@@ -9,12 +9,21 @@ var IS_MOBILE = (
99) ;
1010
1111var CodeMirrorEditor = React . createClass ( {
12+ propTypes : {
13+ lineNumbers : React . PropTypes . bool ,
14+ onChange : React . PropTypes . func
15+ } ,
16+ getDefaultProps : function ( ) {
17+ return {
18+ lineNumbers : false
19+ } ;
20+ } ,
1221 componentDidMount : function ( ) {
1322 if ( IS_MOBILE ) return ;
1423
1524 this . editor = CodeMirror . fromTextArea ( this . refs . editor . getDOMNode ( ) , {
1625 mode : 'javascript' ,
17- lineNumbers : false ,
26+ lineNumbers : this . props . lineNumbers ,
1827 lineWrapping : true ,
1928 smartIndent : false , // javascript mode does bad things with jsx indents
2029 matchBrackets : true ,
@@ -75,6 +84,7 @@ var ReactPlayground = React.createClass({
7584 transformer : React . PropTypes . func ,
7685 renderCode : React . PropTypes . bool ,
7786 showCompiledJSTab : React . PropTypes . bool ,
87+ showLineNumbers : React . PropTypes . bool ,
7888 editorTabTitle : React . PropTypes . string
7989 } ,
8090
@@ -84,7 +94,8 @@ var ReactPlayground = React.createClass({
8494 return JSXTransformer . transform ( code ) . code ;
8595 } ,
8696 editorTabTitle : 'Live JSX Editor' ,
87- showCompiledJSTab : true
97+ showCompiledJSTab : true ,
98+ showLineNumbers : false
8899 } ;
89100 } ,
90101
@@ -122,6 +133,7 @@ var ReactPlayground = React.createClass({
122133 onChange = { this . handleCodeChange }
123134 codeText = { compiledCode }
124135 readOnly = { true }
136+ lineNumbers = { this . props . showLineNumbers }
125137 /> ;
126138
127139 var JSXContent =
@@ -130,6 +142,7 @@ var ReactPlayground = React.createClass({
130142 onChange = { this . handleCodeChange }
131143 className = "playgroundStage"
132144 codeText = { this . state . code }
145+ lineNumbers = { this . props . showLineNumbers }
133146 /> ;
134147
135148 var JSXTabClassName =
0 commit comments