Editor Plugin doesn't react to a new editorState
See original GitHub issuewhen changing the editorState such as re-setting with EditorState.createEmpty(), a user would expect the plugin editor to react to the change in state as DraftJS’s Editor does. But the plugin editor only binds the decorators in componentWillMount so the editor loses the plugins
Issue Analytics
- State:
- Created 7 years ago
- Reactions:1
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Multiple draft-js-plugins editors on the same page don't work
I'm trying to use multiple rich text editors in a React form. I built the editor component using draft ...
Read more >Reference manual - ProseMirror
This module implements the state object of a ProseMirror editor, along with the representation of the selection and the plugin abstraction. Editor State....
Read more >EditorState - Draft.js
Returns a new EditorState object with the selection at the end. Moves selection to the end of the editor without forcing focus. moveFocusToEnd...
Read more >Draft-js - Saving data to the server - React Rocket
If you're fairly new to draft.js you should check out at least the 1st one ... import { EditorState, Editor, convertToRaw } from...
Read more >Reference Manual - CodeMirror
class EditorState. The editor state class is a persistent (immutable) data structure. To update a state, you create a transaction, which produces a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

I think this would be the wrong thing to do, considering that the draft-js regular editor works this way, I think its going to confuse users to not be able to do this. It also seems to violate the API that appears to be a controlled component (i.e. onChange with the editorState as a value).
I think this is actually pretty easy. Should be able to just compare
this.props.editorStatewithnextProps.editorStateand add the decorators to the new editorState if they differ. Only warning I would add is if the decorator object is already definedAlso Related to #251 and #256
@nikgraf any update on this?