-
Notifications
You must be signed in to change notification settings - Fork 13
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
Presence cursors #16
Comments
There's a rabbit hole here that we need to go down which is presence support in JSON1. My understanding:
Our next step here is probably to try using the work from that open PR. Since it's not merged, the easiest way to do that would probably be to take that branch of JSON1 and copy the files to a subdirectory of our project for initial testing. If it works, We'd probably want to maintain a fork JSON1 that has presence (I'm up for this). That JSON1 PR has a chance of being merged I think. Our work here may enable that, since it seems to me the main blocker for merging that PR is a working open source example. |
I created an updated PR in JSON1 with the Presence PR merged with the latest upstream: I'm realizing our setup is a bit problematic, because we're using sharedb-client-browser, which bundles JSON1 into it. So swapping out the JSON1 implementation requires some changes there I think. Anyway that should be updated to the latest ShareDB too, I created an issue for that as well vizhub-core/sharedb-client-browser#2 |
OK this spurred a bunch of activity:
But as all that is pending, I'm thinking we go with the following solution to test the JSON1 with presence:
|
Also dropped a line in the CodeMirror Forum to sanity check the APIs https://discuss.codemirror.net/t/how-to-show-peers-cursors-on-cm6-collab-editor/3996/6. Pasting that here: I’m also interested in doing this. I have collaborative editing working, backed by the OT algorithm of ShareDB, and I would like to add “presence cursors”. ShareDB has a presence API which takes care of the information handling aspect including broadcasting presence and handling cursor transformations. I’m curious where the best place to start would be in terms of the CodeMirror API. To implement presence cursors, we need the following:
I’m guessing that for displaying the widget, this is the best place to start: Or maybe this one, I’m not sure: In terms of listening for where the cursor is and when selections change, I have no clear idea on where to start. I would guess that we need to create a plugin for this that has a side effect of emitting events when the selection changes. This thread seems relevant to that quest: https://discuss.codemirror.net/t/codemirror-6-proper-way-to-listen-for-changes/2395/9 which leads to which I notice has a property called I’ll attempt an implementation based on these ideas and report back if I can get it working! In the mean time, any guidance on the approach or the APIs to best use would be greatly appreciated. Thanks! |
If we could get a PoC working for any of these subproblems, that would be great progress: CodeMirror subproblems:
ShareDB subproblems:
|
Huge progress today: Published these NPM packages:
Now we should be able to just upgrade the |
The build was borked and I worked on it. This is the resulting PR: vizhub-core/sharedb-client-browser#8 |
Whoah it looks like this repo might have a full blown presence implementation for CodeMirror! |
Upgraded dependencies of this package which resulted in a PR against CodeMirror itself |
Cursors that show the other users' positions and selections.
Maybe each participant gets their own color?
Here's how VSCode + LiveShare does it:
The cursors should probably disappear if a user is idle for a long time.
The text was updated successfully, but these errors were encountered: