Skip to content
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

Cusrsors with multiple prose mirror views in one yjs doc and awearness #19

Closed
wants to merge 8 commits into from

Conversation

boschDev
Copy link
Contributor

This is a optional parameter for the cursor plugin.
First I wanted to make an id of the _item.id to combine the client and the id. But when I checked it on a yXmlFragment on the root of the yDoc it seems that the _item was null. Maybe is missed something to get a unique id for each yXmlFragments.
The first implementation I tried all the cursors would be saved in a different key name in the awareness state. After the first test that was not a great solution. If you have a lot of prose mirror views there will also be a lot of keys in that awareness state. I kept this in when somebody wants to change the cursor state name.
After this I added an id in the cursor info and only rendered the cursor when the id is correct for that prose mirror view. I will also open a pr in the yjs demo's where I changed the prose mirror example to 2 prose mirror views with cursors. That was also the case I used to test this.

@anilgulecha
Copy link

@boschDev is this usable? I too have a scenario where there's multiple tiptaps backed by single yjs doc and this PR can help

@dmonad dmonad closed this in b8c0555 Sep 12, 2020
@dmonad
Copy link
Member

dmonad commented Sep 12, 2020

I assume the issue was that the cursor position jumped around because both instances wanted to control the position.

This was a bug. This should always have been possible without giving a name to the prosemirror binding. All editor bindings use the 'cursor' field to propagate cursor information. I fixed the bug and also specified a field 'cursorStateField' that allows you to specify a different cursor field (in case you want to show two selections from two editors).

I published a new release 0.3.7 that fixes the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants