question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

UndoButton/RedoButton cannot be initialized before Editor

See original GitHub issue

Hi,

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:closed
  • Created 6 years ago
  • Comments:9 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Hongbo-Miaocommented, Mar 14, 2018

I think this also happens to LinkButton. Got same error if editor is not ready.

0reactions
stale[bot]commented, Dec 8, 2020

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found