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

Consider removing the React dependency? #298

Closed
pubuzhixing8 opened this issue Sep 14, 2021 · 6 comments
Closed

Consider removing the React dependency? #298

pubuzhixing8 opened this issue Sep 14, 2021 · 6 comments
Milestone

Comments

@pubuzhixing8
Copy link

Hey,

Thank you for your contribution. We also chose slate + yjs + slate-yjs as the technical solution for collaborative editing, and our development work has been basically completed.
But our front-end framework is Angular, so we developed an Angular-based view layer slate-angular based on slate. Fortunately, the logic of slate-yjs is also adapted to slate-angular, but it relies on react, so we have to recreate the repo , Copy most of the code snippets...

As mentioned earlier, our real-time collaborative editing has been developed and we have tried to solve some problems (Undos management). Of course, there are some problems that have not been solved (such as Relative position). We will create related Issues and PRs. Hope it is helpful to slate-yjs.

If the dependencies of react can be removed, then we can directly rely on slate-yjs instead of maintaining two repositories.
Thanks and good wishes

@BitPhinix
Copy link
Owner

Hi @pubuzhixing8,

Awesome to hear that you are using slate-yjs in production. Your help would definitely be very appreciated! Sadly we currently rely on the react peer-dependency for cursors, but with the rewrite in v4 we could clean up the API a bit and might be able to remove that dependency.

I wasn't aware that there are different view layer implementations of slate, thanks for bringing that to my attention 😄

@Hideman85
Copy link

I do agree I used also this lib in backend (NodeJS) because I do some replacement under the document and then I need to force the normalisation of the editor while everything sync back to the Yjs doc store.

I do not want to have extra library like react in backend, so I just added a react.js with module.exports = {} as current workaround. This is a good enough temp solution. The best could to have model/utils/plugin separately imported as needed.

@nemanja-tosic
Copy link
Contributor

Even with the removed dependency, it would be a good idea for this repo to provide for react/angular/other specific implementations.

I would say a monorepo with multiple "adapter" packages would do the trick for that - have a core slate-yjs repo that only does slate-yjs stuff, slate-yjs-react for the addition of the react hooks and others, etc... It should be relatively simple to do, and if a major bump is coming either way it might be the perfect time to do it.

@BitPhinix
Copy link
Owner

My goal for v4 is to make cursors entirely platform-independent, so just have a CursorPlugin.decorate utility which returns a function you can pass to either slate-react or slate-angular etc. (maybe memorized so you don't even have to useMemo in react.

Btw, so sorry for taking so long on v4 but it's hard to prioritize working on this rn. There are some awesome changes coming including an almost complete document flattening (using nested Y.XmlTexts) which would result in idiomatic conflict resolution in almost all cases.

@Hideman85
Copy link

Looking forward, it sounds awesome! It would be nice also to consider a simple conversion script for production data.
Do you have a branch where you push your current progress? You could also attract some community members doing a part like cursor for angular ;)

@BitPhinix BitPhinix added this to the v4 milestone Nov 1, 2021
@BitPhinix
Copy link
Owner

Next is split into core and react, core contains all frontend independent logic/utils and doesn't have a react dependency.

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

No branches or pull requests

4 participants