The current react application keeps track of the EditorState and rerenders whenever the EditorState changes. In the utilization of the rich text editor, we allow and support the option of being able to append text from a selection of multiple choices from a popup. We bring these changes over and push the new text information into the ContentState.

Issue: Whenever EditorState pushes the current editor state with the newly created instance of content state, the EditorState returns an instance where the EditorState has never received or appended the new content state.

Example: In the text editor the currrent content contains Foo but when text information is being appended Test the editorstate rerenders with the information FooTest, but then a second rerender is triggered and reverts the EditorState back to "Foo". I think this has to do with the react-draft-wysiwyg Editor component parameter onEditorStateChange which does trigger twice.

Here are links to images containing steps to re-create the process.

[Text Editor State] https://ibb.co/VBpQrnf

[Appending text from selection] https://ibb.co/3kV0gnC

[Re-render counters] https://ibb.co/Cnd8CBn

Packages and versions: "draft-js": "^0.11", "react": "^17.0.1", "react-draft-wysiwyg": "^1.14.7"

0

There are 0 best solutions below