-
Notifications
You must be signed in to change notification settings - Fork 4.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
Code Editor: Content changes not respected when using mode change keyboard shortcut #9512
Comments
Looked into this. The problem is that We can fix this by calling I'm thinking that we should change our approach again so that Any thoughts? |
I'm curious to learn more about this. It doesn't seem to follow that the UI should ever be falling out of sync with state, regardless in which tick the change to state occurs. What specifically do you observe? Are the blocks in the Visual Editor not "up to date" with changes made in the Code Editor? |
Hi all, Any news about this??? How can we help? (coding, reviewing...?) Thx, |
Reported here also: https://core.trac.wordpress.org/ticket/47892 |
An issue related to this is that the Preview and Publish buttons don't transition from disabled to enabled until the text field is unfocused. See https://core.trac.wordpress.org/ticket/47791. |
I am genuinely surprised that this data loss bug (and yes, I have personally lost data because of this bug, so I'm not just talking about theoreticals here) has remained unfixed for more than two years. |
Would you like to channel your frustration into a PR? It's very cathartic 🙂 |
Fixed in #9512 |
@grzim: see #29988 (comment) |
The issue has to be reopened due to regression made by #9512 The issue can be solved in a different way than saving content on blur. The alternative is to save on switching editors. |
The issue was fixed in #40730 and will be included in WP 6.0. |
Describe the bug
When making a change to the post content in the Code Editor and retaining focus within the Code Editor's textarea, switching back to Visual Editor reveals that the changes were not applied if the change in editor modes is applied using the keyboard shortcut.
To Reproduce
Expected behavior
Changes made in Step 3 are shown in Visual Editor.
Additional context
This is due to the PostTextEditor component's "delayed sync" behavior, where we do not parse on individual keypresses, only when the user "finishes editing". The current metric for determining that a user has finished their edits is the
blur
event. But within this workflow, theblur
event is not triggered (or at least not handled by PostTextEditor, perhaps due to the fact that it will have unmounted by the time it's called).A possible fix may be to consider whether there are unsaved changes in the PostTextEditor's
componentWillUnmount
and invoking theonPersist
prop.The text was updated successfully, but these errors were encountered: