File tree Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Expand file tree Collapse file tree 2 files changed +9
-5
lines changed Original file line number Diff line number Diff line change @@ -37,9 +37,6 @@ var App = createReactClass({
3737 readOnly : ! this . state . readOnly
3838 } , ( ) => this . refs . editor . focus ( ) ) ;
3939 } ,
40- interact ( cm ) {
41- console . log ( cm . getValue ( ) ) ;
42- } ,
4340 render ( ) {
4441 var options = {
4542 lineNumbers : true ,
@@ -48,7 +45,7 @@ var App = createReactClass({
4845 } ;
4946 return (
5047 < div >
51- < Codemirror ref = "editor" value = { this . state . code } onChange = { this . updateCode } options = { options } interact = { this . interact } />
48+ < Codemirror ref = "editor" value = { this . state . code } onChange = { this . updateCode } options = { options } autoFocus = { true } />
5249 < div style = { { marginTop : 10 } } >
5350 < select onChange = { this . changeMode } value = { this . state . mode } >
5451 < option value = "markdown" > Markdown</ option >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ function normalizeLineEndings (str) {
1414
1515const CodeMirror = createReactClass ( {
1616 propTypes : {
17+ autoFocus : PropTypes . bool ,
1718 className : PropTypes . any ,
1819 codeMirrorInstance : PropTypes . func ,
1920 defaultValue : PropTypes . string ,
@@ -116,7 +117,13 @@ const CodeMirror = createReactClass({
116117 ) ;
117118 return (
118119 < div className = { editorClassName } >
119- < textarea ref = "textarea" name = { this . props . path } defaultValue = { this . props . value } autoComplete = "off" />
120+ < textarea
121+ ref = "textarea"
122+ name = { this . props . path }
123+ defaultValue = { this . props . value }
124+ autoComplete = "off"
125+ autoFocus = { this . props . autoFocus }
126+ />
120127 </ div >
121128 ) ;
122129 } ,
You can’t perform that action at this time.
0 commit comments