-
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
Save editors value on change #27717
Save editors value on change #27717
Conversation
Size Change: -20.6 kB (-2%) Total Size: 1.28 MB
ℹ️ View Unchanged
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks for fixing. 👍
The only bothersome thing I noticed in my testing is that you get lots of block validation errors in the console while you're typing out a block. But, this isn't really new—it happened before when you blur the textfield. And, I doubt many users type out a block manually.
…t is not forgotten when a dislpay mode is changed
…nge to editor has been introduced and given throttle time has passed
… setTimeout in index
608fe1f
to
eab4a74
Compare
Thanks for fixing this longstanding issue!! |
@@ -7,13 +7,14 @@ import Textarea from 'react-autosize-textarea'; | |||
/** | |||
* WordPress dependencies | |||
*/ | |||
import { useSelect } from '@wordpress/data'; | |||
import * as wp from '@wordpress/data'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it should be removed, useSelect
is mocked with jest.mock
call in another place. So const useSelect = wp.useSelect;
is redundant.
It looks like this PR might be causing the issue here: #29988 |
* revert #27717 (#30524) Co-authored-by: grzim <[email protected]> * Use getAuthors for 'showCombobox' check (#30218) * Use getAuthors for 'showCombobox' check * Add inline comment * Gallery: Set 'addToGallery' prop to false when images don't have IDs. (#30122) This also sets MediaPlaceholder value to an empty object. With both props set to "falsy" values, the gallery media frame is initialized in the "Create Gallery" state. This lets users replace placeholder images from patterns. Co-authored-by: Grzegorz <[email protected]> Co-authored-by: grzim <[email protected]> Co-authored-by: George Mamadashvili <[email protected]>
* revert #27717 (#30524) Co-authored-by: grzim <[email protected]> * Use getAuthors for 'showCombobox' check (#30218) * Use getAuthors for 'showCombobox' check * Add inline comment * Gallery: Set 'addToGallery' prop to false when images don't have IDs. (#30122) This also sets MediaPlaceholder value to an empty object. With both props set to "falsy" values, the gallery media frame is initialized in the "Create Gallery" state. This lets users replace placeholder images from patterns. Co-authored-by: Grzegorz <[email protected]> Co-authored-by: grzim <[email protected]> Co-authored-by: George Mamadashvili <[email protected]>
Description
Resolving the issue #9512
The problem was the lack of updates when a user makes a change in an editor but only when the editor lost focus. This was causing situations when users were losing their input when using key shortcuts to change editor mode.
The solution is to add debounced updates after every change made in the editor. The same mechanics are used to save the text as it was done in stopEditting function (which is called when the editor is losing focus).
The function is debounced in order to minimize the number of dispatches.
How has this been tested?
Unit test to cover this case added
Screenshots
Types of changes
Bugfix
Checklist: