Skip to content

Add cursor synchronization to an editor #128

@MrTin

Description

@MrTin

Hi ShareDB Team,

It's so fun to play around with this – thanks for sharing ShareDB to the open source community!

I was wondering how I could go about and add cursor sync to ShareDB. I'm trying out the rich-text example (that uses Quill) and was curious how you could make it look like Google Docs, where it points out another clients cursor, color and name. I was looking at https://github.com/hivejs/hive-plugin-cursor-broadcast-codemirror but I realized that you guys proabably have a better answer to my question.

Is this a good example to use middleware for? Am I thinking right here? ShareDB listens to the WS stream so won't I make it "crash" by sending my own commands (cursor position) in the stream?

My idea is the following:

  • Create a middleware for authentication using JWT.
  • During socket connection, store the color and name of the client.
  • Create a middleware for synchronizing cursor position(?)

Thanks for any help!

Regards,
Martin

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions