@@ -21,6 +21,7 @@ import 'codemirror/addon/search/matchesonscrollbar';
21
21
import 'codemirror/addon/search/match-highlighter' ;
22
22
import 'codemirror/addon/search/jump-to-line' ;
23
23
import 'codemirror/addon/edit/matchbrackets' ;
24
+ import 'codemirror/addon/edit/closebrackets' ;
24
25
25
26
import { JSHINT } from 'jshint' ;
26
27
import { CSSLint } from 'csslint' ;
@@ -104,6 +105,7 @@ class Editor extends React.Component {
104
105
keyMap : 'sublime' ,
105
106
highlightSelectionMatches : true , // highlight current search match
106
107
matchBrackets : true ,
108
+ autoCloseBrackets : this . props . autocloseBracketsQuotes ,
107
109
lint : {
108
110
onUpdateLinting : ( ( annotations ) => {
109
111
this . props . hideRuntimeErrorWarning ( ) ;
@@ -205,6 +207,9 @@ class Editor extends React.Component {
205
207
if ( this . props . lineNumbers !== prevProps . lineNumbers ) {
206
208
this . _cm . setOption ( 'lineNumbers' , this . props . lineNumbers ) ;
207
209
}
210
+ if ( this . props . autocloseBracketsQuotes !== prevProps . autocloseBracketsQuotes ) {
211
+ this . _cm . setOption ( 'autoCloseBrackets' , this . props . autocloseBracketsQuotes ) ;
212
+ }
208
213
209
214
if ( prevProps . consoleEvents !== this . props . consoleEvents ) {
210
215
this . props . showRuntimeErrorWarning ( ) ;
@@ -370,6 +375,7 @@ class Editor extends React.Component {
370
375
}
371
376
372
377
Editor . propTypes = {
378
+ autocloseBracketsQuotes : PropTypes . bool . isRequired ,
373
379
lineNumbers : PropTypes . bool . isRequired ,
374
380
lintWarning : PropTypes . bool . isRequired ,
375
381
linewrap : PropTypes . bool . isRequired ,
0 commit comments