From 4e86666f5e8acf9ef8db008f279e6ffed9c0bdc9 Mon Sep 17 00:00:00 2001 From: abumalick Date: Mon, 15 Oct 2018 22:45:42 +0200 Subject: [PATCH] Don't update content if undefined In the current state, if content prop is undefined, the editor would reset his content at every update. Checking if content prop is undefined before updating fixes this behavior. If one needs to reset the editor he can pass an empty string to the content prop. --- src/ckeditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ckeditor.js b/src/ckeditor.js index e703048..633d464 100644 --- a/src/ckeditor.js +++ b/src/ckeditor.js @@ -33,7 +33,7 @@ class CKEditor extends React.Component { componentWillReceiveProps(props) { const editor = this.editorInstance; - if (editor && editor.getData() !== props.content) { + if (props.content !== undefined && editor && editor.getData() !== props.content) { editor.setData(props.content); } }