@@ -21,6 +21,7 @@ import 'codemirror/addon/search/matchesonscrollbar';
2121import 'codemirror/addon/search/match-highlighter' ;
2222import 'codemirror/addon/search/jump-to-line' ;
2323import 'codemirror/addon/edit/matchbrackets' ;
24+ import 'codemirror/addon/edit/closebrackets' ;
2425
2526import { JSHINT } from 'jshint' ;
2627import { CSSLint } from 'csslint' ;
@@ -104,6 +105,7 @@ class Editor extends React.Component {
104105 keyMap : 'sublime' ,
105106 highlightSelectionMatches : true , // highlight current search match
106107 matchBrackets : true ,
108+ autoCloseBrackets : this . props . autocloseBracketsQuotes ,
107109 lint : {
108110 onUpdateLinting : ( ( annotations ) => {
109111 this . props . hideRuntimeErrorWarning ( ) ;
@@ -205,6 +207,9 @@ class Editor extends React.Component {
205207 if ( this . props . lineNumbers !== prevProps . lineNumbers ) {
206208 this . _cm . setOption ( 'lineNumbers' , this . props . lineNumbers ) ;
207209 }
210+ if ( this . props . autocloseBracketsQuotes !== prevProps . autocloseBracketsQuotes ) {
211+ this . _cm . setOption ( 'autoCloseBrackets' , this . props . autocloseBracketsQuotes ) ;
212+ }
208213
209214 if ( prevProps . consoleEvents !== this . props . consoleEvents ) {
210215 this . props . showRuntimeErrorWarning ( ) ;
@@ -370,6 +375,7 @@ class Editor extends React.Component {
370375}
371376
372377Editor . propTypes = {
378+ autocloseBracketsQuotes : PropTypes . bool . isRequired ,
373379 lineNumbers : PropTypes . bool . isRequired ,
374380 lintWarning : PropTypes . bool . isRequired ,
375381 linewrap : PropTypes . bool . isRequired ,
0 commit comments