diff --git a/lib/components/TinyMCE.js b/lib/components/TinyMCE.js index 7c1e2e2..d3cdbb0 100644 --- a/lib/components/TinyMCE.js +++ b/lib/components/TinyMCE.js @@ -1,7 +1,7 @@ import React from 'react'; import { findDOMNode } from 'react-dom'; import isEqual from 'lodash/lang/isEqual'; -import clone from 'lodash/lang/clone'; +import cloneDeep from 'lodash/lang/cloneDeep'; import uuid from '../helpers/uuid'; import ucFirst from '../helpers/ucFirst'; @@ -51,7 +51,6 @@ const TinyMCE = React.createClass({ }, componentDidMount() { - const config = clone(this.props.config); this._init(config); }, @@ -91,11 +90,15 @@ const TinyMCE = React.createClass({ ); }, - _init(config, content) { + _init(configProp, content) { if (this._isInit) { this._remove(); } + // Clone the config prop to prevent modifications by TinyMCE, which + // would cause the react component to be updated incorrectly. + var config = cloneDeep(configProp); + // hide the textarea that is me so that no one sees it findDOMNode(this).style.hidden = 'hidden';