Only set Editor option on change

This commit is contained in:
Gregory Schier 2017-02-07 17:52:05 -08:00
parent 8d5ad857a0
commit a49564a829

View File

@ -282,6 +282,16 @@ class Editor extends Component {
// Strip of charset if there is one
Object.keys(options).map(key => {
// Don't set the option if it hasn't changed
if (options[key] === this.codeMirror.options[key]) {
return;
}
// Since mode is an object, let's compare the inner baseMode instead
if (key === 'mode' && options.mode.baseMode === this.codeMirror.options.mode.baseMode) {
return;
}
this.codeMirror.setOption(key, options[key]);
});
}