codeslayer1 / react-ckeditor

CKEditor component for React with plugin and custom event listeners support
MIT License
130 stars 34 forks source link

CKEditor with redux-form rerenders while changing content #61

Closed vivek7890 closed 5 years ago

vivek7890 commented 5 years ago

I see a problem when I try to change the content of CKEditor, all the time it flickers. I am using CKEditor with redux-form.

Here is my code -

onChange = e => {
    var newContent = e.editor.getData();
    // Send data to redux-form
    this.props.onChange(newContent);
  };
<CKEditor
        activeClass="p10"
        scriptUrl="/vendor/ckeditor/ckeditor.js"
        content={this.props.value}
        key={this.props.value}
        events={{
          change: this.onChange,
        }}
      />
vivek7890 commented 5 years ago

Finally, I solved this issue by using the following code -

shouldComponentUpdate() {
    return false;
  }

I also followed this issue on stack over flow- https://stackoverflow.com/a/24871991/5198573