-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Toggling readOnly prop from true to false breaks the Editor #3321
Comments
@martonlanga I'm also struggling with this bug. Do you have any fix or any work around yet? |
Hey @rockcs1992, I think the only workaround for now is to init the Editor to with readOnly set to false, then change it to true. |
@martonlanga Thanks for the update. I think I will go with your workaround at the moment. 😄 |
Another workaround until #3388 is merged is that you can set a key on the Slate component to be equal to your readOnly state, this seems to force Slate into the correct state. |
@Francesco-Lanciana That makes sense, great workaround! |
@Francesco-Lanciana Great that works! |
Do you want to request a feature or report a bug?
Report a bug
What's the current behavior?
Code Sandbox
If you init the Editor with readOnly set to true, then toggle it to false, the onChange method won't be called when making changes. But you can still edit the value, and see the changes.
If you init the Editor with readOnly set to false, everything works as expected.
Slate: 0.54.2
Browser: Chrome / Firefox
OS: Mac
What's the expected behavior?
Call
onChange
even after toggling thereadOnly
prop.Slack thread
The text was updated successfully, but these errors were encountered: