-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Record selection changes in history (undo) #17824
Conversation
36c3145
to
1057917
Compare
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.
Great work! I just have one question, otherwise it looks perfect.
@@ -84,54 +141,121 @@ describe( 'undo', () => { | |||
await pressKeyWithModifier( 'primary', 'z' ); // Undo 3rd paragraph text. | |||
|
|||
expect( await getEditedPostContent() ).toBe( thirdBlock ); |
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.
We should add a check before the first undo here.
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.
It should be enough to only test selection after undo right? After typing, we already know for sure where the selection is.
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.
After typing, we already know for sure where the selection is.
It wouldn't hurt to verify that it synced correctly.
ffebda8
to
63de0ad
Compare
Unsure why one of the selection tests is failing. Need to have another look into it. |
63de0ad
to
6e47e7a
Compare
Rebased the PR and fixed the e2e test failure (caused by a miscalculation). @epiqueras would you be up for having another look? |
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 is looking great.
Not a blocker, but I think we could do with some "multi-selection" test cases.
Multi selection + undo/redo tests don't seem trivial to add since it doesn't seem to be fully working. It resets to a collapsed range. I think I'd prefer to merge this as is now, and polish the behaviour with follow up PRs. The PR in its current form is already many times better than the current behaviour in master. |
Sounds good. |
Thanks for the review @epiqueras! |
Did we check what issues can be closed with this. I think we might have a few of these. |
@youknowriad I only found #12327. |
Interesting, I'm pretty sure I saw issues about the caret not restored to the right position on undo. We'll find them in triage sessions anyway. |
Description
Same as #16428, but adjusted after #16932.
Stores selection in the undo reducer. The following gif shows the result after two times undo:
How has this been tested?
Screenshots
Types of changes
Checklist: