Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Block Editor: Fix undo level inconsistencies. #17259
This PR fixes a couple of undo level related inconsistencies that surfaced after merging #16932.
In the Block Editor,
In the Editor, the decision was made to consider initial edits as dirtying operations that create an undo level and enable saving functionality. For some reason, the server sends an empty initial edit with empty strings for the title, excerpt, and content of new posts. This results in another unnecessary undo level. This PR fixes this by ignoring initial edits that would not change any values of the post.
How has this been tested?
It was verified that typing two words with a pause in between does not create an undo level and that new posts don't load with an undo level.
Types of Changes
Bug Fix: Stop inserting unnecessary undo levels between words an on empty posts.
@epiqueras RichText doesn't mark the first character as persistent. It continuously calls
Well, it follows this logic:
The first character's edit is not updating the same attribute as the last edit right?
How should we go about this?
I think the logic behind
Also, do you have an example of a release where this worked correctly?
Looks way better now.
Still seeing some inconsistencies.
ellatrix left a comment
Functionally it looks good. Would be great if the last e2e test case that I added could be fixed. Codewise I don't have any objections, but would be great if someone familiar with the
So this is all fine in the end? Anything that should be changed?
* Block Editor: Skip explicit persistent marking actions when comparing against the last action in the persistent block change HOR. * Editor: Ignore initial edits that wouldn't change post values. * Add e2e tests that should pass * Core Data: Fix undo approach. * Add e2e test case for undo level creation on save * Add passing e2e that would fail before * Revert d1817b6