UndoButton/RedoButton cannot be initialized before Editor
See original GitHub issueHi,
I’m writing a toolbar with DraftJS, and it will be rendered before the Editor.
<div>
<Toolbar><RedoButton/><UndoButton/></Toolbar>
<Editor .../>
</div>
I think it’s because the RedoButton/UndoButton didn’t consider the situation that the Editor has not been initialized before the buttons are rendered.
Uncaught TypeError: this.props.store.getEditorState is not a function
at UndoButton.render (index.js:59)
at ReactCompositeComponent.js:796
at measureLifeCyclePerf (ReactCompositeComponent.js:75)
at ReactCompositeComponentWrapper._renderValidatedComponentWithoutOwnerOrContext
Exception line: https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-undo-plugin/src/RedoButton/index.js#L21
When the method “getEditorState” is actually initialized: https://github.com/draft-js-plugins/draft-js-plugins/blob/master/draft-js-undo-plugin/src/index.js#L30
Issue Analytics
- State:
- Created 6 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
Undo or redo typing or design changes - Microsoft Support
You can undo and redo data entry for the most-recently edited record, ... When an action cannot be undone, the Undo Typing command...
Read more >Implement undo/redo button in JavaFX [closed] - Stack Overflow
Start with a comilable example, and say why it doesn't work. This github.com/PaluchLabUCL/DeformingMesh3D-plugin/tree/master/src/… is how I ...
Read more >Undo & Redo - Movie Magic Budgeting Manual
You can redo undone actions until you make another edit to your budget. ... Click the UNDO button (a left-turning arrow) in the...
Read more >set initial color of 'undo' and 'redo' button to grey · Issue #970 ...
Hi! After editor initialization, the 'undo' and 'redo' buttons are black. However, the undo / redo stack is empty and clicking on of...
Read more >New Undo/Redo buttons in the Confluence editor
Undo and redo should now “just work”! BEFORE A second undo… re-does?. undo_before_1.gif. AFTER.
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 also happens to LinkButton. Got same error if editor is not ready.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.