From 1b3aec4ebffb2bba7f1daf04288488e46210a6e2 Mon Sep 17 00:00:00 2001 From: Damien Duhamel Date: Tue, 25 Jul 2017 10:28:35 +0200 Subject: [PATCH] Add some comments --- .../Widgets/MarkdownControlElements/VisualEditor/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/components/Widgets/MarkdownControlElements/VisualEditor/index.js b/src/components/Widgets/MarkdownControlElements/VisualEditor/index.js index 59549b04..a00620ca 100644 --- a/src/components/Widgets/MarkdownControlElements/VisualEditor/index.js +++ b/src/components/Widgets/MarkdownControlElements/VisualEditor/index.js @@ -135,8 +135,10 @@ export default class Editor extends Component { componentDidUpdate(prevProps, prevState) { const editorValue = this.state.serializer.serialize(this.view.state.doc); - + // Check that the content of the editor is well synchronized with the props value after rendering. + // Sometimes the editor isn't well updated (eg. after items reordering) if (editorValue !== this.props.value && editorValue !== prevProps.value) { + // If the content of the editor isn't correct, we update its state with a new one. this.view.updateState(this.createEditorState()); } }