File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -25,8 +25,8 @@ var CodeMirror = React.createClass({
2525this . codeMirror . on ( 'change' , this . codemirrorValueChanged ) ;
2626this . codeMirror . on ( 'focus' , this . focusChanged . bind ( this , true ) ) ;
2727this . codeMirror . on ( 'blur' , this . focusChanged . bind ( this , false ) ) ;
28- this . _currentCodemirrorValue = this . props . value ;
29- this . codeMirror . setValue ( this . props . value ) ;
28+ this . _currentCodemirrorValue = this . props . defaultValue || this . props . value || '' ;
29+ this . codeMirror . setValue ( this . _currentCodemirrorValue ) ;
3030} ,
3131
3232componentWillUnmount ( ) {
@@ -37,7 +37,7 @@ var CodeMirror = React.createClass({
3737} ,
3838
3939componentWillReceiveProps ( nextProps ) {
40- if ( this . codeMirror && this . _currentCodemirrorValue !== nextProps . value ) {
40+ if ( this . codeMirror && nextProps . value !== undefined && this . _currentCodemirrorValue !== nextProps . value ) {
4141this . codeMirror . setValue ( nextProps . value ) ;
4242}
4343if ( typeof nextProps . options === 'object' ) {
You can’t perform that action at this time.
0 commit comments