hyperhyperspace / hyper-browser-web

A web-based hyper browser.
6 stars 0 forks source link

Basic Y.js integration in the wiki block editor #12

Open micahscopes opened 2 years ago

micahscopes commented 2 years ago

TipTap has a really nice Y.js integration. @sbazerque and I discussed using this for wiki block collaboration in synchronous contexts. The main motivation is that Y.js is optimized for real-time collaborative text editing while HHS CRDTs are not. Currently wiki block editing is last write wins.

One possible implementation would give wiki block authors the ability to delegate editing abilities to currently connected peers via Y.js. Wiki block authors would still retain the authority to actually persist the changes coming from Y.js. In the case where a wiki block has multiple authors, they'd still need to be careful because the HHS persistence would still be last write wins.

In a simple UI for this implementation, wiki block authors would just automatically persist updates, but another possibility would be to implement a kind of "collaborative suggestion mode" that could be turned on to enable the Y.js collaboration and disabled by either accepting or rejecting the suggested changes.

To do:

micahscopes commented 2 years ago

For the very first pass I'm just going to use the y-webrtc connection adapter directly without worrying about reusing HHS connections.

micahscopes commented 2 years ago

@sbazerque and I managed to understand a little edge case that occurs around the time of HHS persistence. Basically updates to the old version's Yjs "window" get orphaned. Maybe it's possible with some simple Yjs understanding to rescue the orphaned updates and apply them to the latest Yjs "window".