-
Notifications
You must be signed in to change notification settings - Fork 67
Description
Do you want to request a feature or report a bug?
Bug. See #170 (comment). It seems that the saveState call within the editor’s onBlur is both useless, and potentially a source of headaches when managing the editor’s state.
What is the current behavior?
See #170 (comment).
I'll start with the save
onBlurwhich actually is causing an issue for us in one specific instance. We have a form 'wizard' which has a footer container with the buttons to navigate forward and backwards. We have a sibling 'wizard content' container which has the editor. When the user has focus in the editor and immediately clicks the 'next' button,onBlurinitiates the unnecessaryonSavewhich dispatches to Redux and causes a re-render of that container. The footer container does not re-render and the click event on the button is lost.If I comment out the
this.saveState()in mynode_modulesversion of the editor, my render problem goes away. If had the button and the editor in the same container, there is no problem either as they are rendered together but, unfortunately, I don't have any flexibility with our UX design to do that. We also have other instances of the editor where a button and editor are in the same container and they work flawlessly.I believe that the save
onBluris really unnecessary becauseonSaveis called after every change is processed so it seems like there should never be something new savedonBlur.My use case for customized
onBluris whether or not to display validation results. I can validateonSavebut I don't know when the user is actually "done" filling in their info.I don't currently have a use for
onFocus, but it's not hard to imagine that someone might need that for some legitimate reason.Thanks for considering!
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem. GIFs and screenshots are very helpful too.
- Focus the editor
- Enter content
- Move focus elsewhere
- Watch
saveStatecalls
What is the expected behavior?
The saveState callback should ideally not be called multiple times with outdated content.