-
-
Notifications
You must be signed in to change notification settings - Fork 17
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
Collaborator cursors can jump to the next line while they type #14
Comments
…on silent Quill events
[Issue yjs#14] Prevent _quillObserver from updating awareness states on …
it looks like the same I have no idea why it was closed ( |
Solution above does not work for me ( |
I did some workaround to fix issue by handling cursors by my own putting out if something can be helpful
Add module in option as per quill-cursors doc
// check presense of people accessing doc
// you can just use them and handle cursors easiest way to copy these method
handleCursors is all cusror handling code from _quillObserver check _quillObserver method from y-quill/src/y-quill.js |
Describe the bug
When watching awareness updates from another user as they type at the end of a line, you can occasionally see the cursor jump down to the next line then back up to the text being written. See this YJS discussion thread on the exact issue, including a nice reproduction video: https://discuss.yjs.dev/t/cursor-jumping-to-next-line/483
When a user types a letter into the Quill editor, it triggers two events that are sent to and handled by
_quillObserver
, first a'selection-change'
event with source'silent'
, and second a'text-change'
event with source'user'
._quillObserver
will attempt to update the cursor awareness for both events, in that order, triggering theawareness.setLocalStateField
emitting an awareness event out to other users.From here, it's a race condition for whether the first
selection-change
update gets to a collaborative user and updates the awareness for the cursor on their screen BEFORE of AFTER thetext-change
fully propogates. If it happens before, the cursor jumps forward a single index, making it twitch to the next line in the document, then the content of the document is updated to add the new character, and the selection is fixed.To Reproduce
Steps to reproduce the behavior:
Expected behavior
The cursor that is typing stays smoothly attached to the end of the text that it is typing, without jumping forward in the document
Screenshots
See the YJS discussion thread linked in the description for a great example video
Environment Information
The environment for my Quill editor:
Also works against the y-quill demo.
Suggested Solution
There doesn't seem to be a reason for the awareness update to fire for the
'selection-change'
Quill event with a'silent'
source. The awareness will only need to update correctly when the actual text change is also getting propogated over to other users, i.e. on the'text-change'
event.Not updating the awareness when the source is
'silent'
should correct the issue. PR to follow.The text was updated successfully, but these errors were encountered: