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({
37
37
readOnly : ! this . state . readOnly
38
38
} , ( ) => this . refs . editor . focus ( ) ) ;
39
39
} ,
40
- interact ( cm ) {
41
- console . log ( cm . getValue ( ) ) ;
42
- } ,
43
40
render ( ) {
44
41
var options = {
45
42
lineNumbers : true ,
@@ -48,7 +45,7 @@ var App = createReactClass({
48
45
} ;
49
46
return (
50
47
< 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 } />
52
49
< div style = { { marginTop : 10 } } >
53
50
< select onChange = { this . changeMode } value = { this . state . mode } >
54
51
< option value = "markdown" > Markdown</ option >
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ function normalizeLineEndings (str) {
14
14
15
15
const CodeMirror = createReactClass ( {
16
16
propTypes : {
17
+ autoFocus : PropTypes . bool ,
17
18
className : PropTypes . any ,
18
19
codeMirrorInstance : PropTypes . func ,
19
20
defaultValue : PropTypes . string ,
@@ -116,7 +117,13 @@ const CodeMirror = createReactClass({
116
117
) ;
117
118
return (
118
119
< 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
+ />
120
127
</ div >
121
128
) ;
122
129
} ,
You can’t perform that action at this time.
0 commit comments