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

Question: Use of yjs #68

Open
JannikStreek opened this issue Mar 21, 2024 · 8 comments · May be fixed by #84
Open

Question: Use of yjs #68

JannikStreek opened this issue Mar 21, 2024 · 8 comments · May be fixed by #84
Assignees

Comments

@JannikStreek
Copy link
Collaborator

JannikStreek commented Mar 21, 2024

Context

I proposed to @SamTV12345 in a private chat the use or at least a test of yjs. It's a library which handles concurrent updates on a datasource and could be a good fit for the project. Additionally or even more interestingly it's very easy to integrate in existing editors, see https://yjs.dev/#demos.

By default it uses peer-to-peer connections which isn't very fitting for etherpad. But a plugin exists to leverage websockets. See https://github.com/yjs/y-websocket . A rough server implementation can be seen here: https://github.com/yjs/y-websocke/blob/master/bin/server.js

It would bring research-grade-level conflict resolution for concurrent updates within the editor and, in addition, many existing editor integrations. At least it should be considered to be used as so much comes essentially for free.

EDIT: Also available as ready-to-go backends:

Tasks

I guess I makes sense to first start a small prototype and see how it goes? Especially before integrating the existing server setup.

@AugustinMauroy
Copy link
Collaborator

In my opinion, the architecture of the pad should be made up of small components:

pad itsel:

const Pad:FC = ()=> {
  //logic here
  return (
    <EditableArea/>
  );
}

button for bold

pad itsel:

const Pad:FC = ()=> {
  const handleBold = () => {}
  return (
    <button onclick={handleBold}//>
  );
}

so that each element has its own component and that makes sense

@SamTV12345
Copy link
Member

Can't we use yjs and still have our own editor? As far as I understood it is quite customizable and we would have a standard implemented than doing something custom.

@JannikStreek
Copy link
Collaborator Author

JannikStreek commented Mar 21, 2024

Can't we use yjs and still have our own editor? As far as I understood it is quite customizable and we would have a standard implemented than doing something custom.

sure, I think thats also possible or at least I can't think of reasons why not. It's just another advantage, that you can integrate existing editors rather quickly.

@JannikStreek
Copy link
Collaborator Author

Only the backend data model will be different as the shared data types won't be compatible the existing model - I guess.

@AugustinMauroy
Copy link
Collaborator

Only the backend data model will be different as the shared data types won't be compatible the existing model - I guess.

We can add an adaptator on etherpad-next v1.X to allow read from old format. What do you thinks.

@JannikStreek
Copy link
Collaborator Author

Only the backend data model will be different as the shared data types won't be compatible the existing model - I guess.

We can add an adaptator on etherpad-next v1.X to allow read from old format. What do you thinks.

All possible, first we would need to test yjs. Then we can decide if we want to use it and how to proceed later with old pads. At least that would be my suggestion. As this will be a complete rewrite, I guess it would also be fine to convert old pads during migration.

@SamTV12345
Copy link
Member

Only the backend data model will be different as the shared data types won't be compatible the existing model - I guess.

We can add an adaptator on etherpad-next v1.X to allow read from old format. What do you thinks.

All possible, first we would need to test yjs. Then we can decide if we want to use it and how to proceed later with old pads. At least that would be my suggestion. As this will be a complete rewrite, I guess it would also be fine to convert old pads during migration.

Absolutely. If you can build a prototype with yjs for evaluation that would be awesome.

@JannikStreek JannikStreek self-assigned this Mar 26, 2024
@JannikStreek
Copy link
Collaborator Author

Ok, I will build a small prototype the next couple of days :)

@JannikStreek JannikStreek linked a pull request Apr 2, 2024 that will close this 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 a pull request may close this issue.

3 participants