-
-
Notifications
You must be signed in to change notification settings - Fork 38
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
fix undo and redo scroll #34
Conversation
Hello @krassowski and @dmonad , if you had time could you please help me testing this PR? I had test it on the yjs demos repo, and it looks good to me. I am new to web development, I am not familiar of the workflow and code. Any suggestions would be great help! |
Thanks for the PR @alissa-tung ! If I understand correctly, this PR adds functionality to scroll the cursor into view when the user hits undo / redo. Can you confirm that this is the default CodeMirror behavior? When the undomanager pops a stack item (i.e. the user performed y-codemirror.next/src/y-undomanager.js Line 88 in faffa7b
If we want to scroll into view, we should perform that action there, without calling I'd accept an updated PR if you can confirm that this emulates the default CodeMirror behavior. Otherwise, we should provide an API so that you can add this custom behavior. |
The default CodeMirror behaviour is to scroll into view if needed, see recording in #31. To be frank, it is the default behaviour of any other editor I know. |
Thank you, I am going to do the following:
|
The native CodeMirror 6 has the following behavior when undo/redo:
I think this is controlled by |
2024-06-18.09-04-19.mp42024-06-18.08-57-27.mp4 |
Hello, @dmonad , I had update the code to make dispatch update selection and scroll in view the same transaction. And I have uploaded two videos to test again the behavior. Feel free to request any changes to this. |
Thank you @alissa-tung ! I'm going to make a new release now. |
I think the changes are closer to the native CodeMirror 6 undo/redo scroll behavior, which is first do undo/redo, then move view to the line of cursor by the
nearest
match.this PR fixes #31