File tree Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Expand file tree Collapse file tree 2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 1818 "codemirror" : " ^5.18.2" ,
1919 "create-react-class" : " ^15.5.1" ,
2020 "lodash.debounce" : " ^4.0.8" ,
21+ "lodash.isequal" : " ^4.5.0" ,
2122 "prop-types" : " ^15.5.4"
2223 },
2324 "devDependencies" : {
2425 "gulp" : " ^3.9.1" ,
2526 "happiness" : " ^7.1.2" ,
2627 "react" : " ^15.5.3" ,
27- "react-dom " : " ^15.5.3 " ,
28- "react-component-gulp-tasks " : " ^0.7.7 "
28+ "react-component-gulp-tasks " : " ^0.7.7 " ,
29+ "react-dom " : " ^15.5.3 "
2930 },
3031 "peerDependencies" : {
3132 "react" : " >=15.5 <16" ,
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ const findDOMNode = ReactDOM.findDOMNode;
44const PropTypes = require ( 'prop-types' ) ;
55const className = require ( 'classnames' ) ;
66const debounce = require ( 'lodash.debounce' ) ;
7+ const isEqual = require ( 'lodash.isequal' ) ;
78const createReactClass = require ( 'create-react-class' ) ;
89
910function normalizeLineEndings ( str ) {
@@ -69,11 +70,17 @@ const CodeMirror = createReactClass({
6970 if ( typeof nextProps . options === 'object' ) {
7071 for ( let optionName in nextProps . options ) {
7172 if ( nextProps . options . hasOwnProperty ( optionName ) ) {
72- this . codeMirror . setOption ( optionName , nextProps . options [ optionName ] ) ;
73+ this . setOptionIfChanged ( optionName , nextProps . options [ optionName ] ) ;
7374 }
7475 }
7576 }
7677 } ,
78+ setOptionIfChanged ( optionName , newValue ) {
79+ const oldValue = this . codeMirror . getOption ( optionName ) ;
80+ if ( ! isEqual ( oldValue , newValue ) ) {
81+ this . codeMirror . setOption ( optionName , newValue ) ;
82+ }
83+ } ,
7784 getCodeMirror ( ) {
7885 return this . codeMirror ;
7986 } ,
You can’t perform that action at this time.
0 commit comments