From 98889236076e00b37313a227bf783b63ff9f0139 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Hu=CC=88bner?= Date: Tue, 22 Mar 2016 15:53:38 +0100 Subject: [PATCH] Fix an issue, that would cause tinymce to be updated too often --- lib/components/TinyMCE.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) 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';