4 ms·
Some people have already solved that, like Liveblocks.io Here's an example of Notion-like text editor with multiplayer: https://liveblocks.io/examples/block-tex
by adigau31 4y ago
Some people have already solved that, like Liveblocks.io
Here's an example of Notion-like text editor with multiplayer: https://liveblocks.io/examples/block-text-editor-advanced/nextjs https://liveblocks.io/examples/block-text-editor-advanced/ne...
(and yes, it is very complex lol)
- mlajtos 4y agoNah, Liveblocks.io + Slate is pretty far from Notion-like experience. It doesn't even do local undo/redo.
- stevenfabre 4y agoLiveblocks does support multiplayer undo/redo. We even wrote an interactive blog post about it: https://liveblocks.io/blog/how-to-build-undo-redo-in-a-multiplayer-environment https://liveblocks.io/blog/how-to-build-undo-redo-in-a-multi... Our open-source block-based text editor could support it too with some extra pluming (which we haven’t got to yet). We’re planning to add this in as more and more developers are looking to port this experience into their own products. Is there anything else you’d like this example to support? Thanks for the feedback! :)
- mlajtos 4y agoReally nice article. I think the undo/redo for rich text is a tad bit more complicated than undo/redo for objects with properties. For starters, in your demo when user A has selected some word and user B writes a letter in it, user A lost the selection. And this isn't even undo/redo yet, just normal collaborative thing. That "some extra plumbing" you mention is quite big. Please don't get me wrong here – I would love to see you pull it off – Liveblocks.io seems like a good platform from what I read & heard, but you underestimate how hard that problem might be.
- jitl 4y agoNotion’s selection and undo/redo with multiplayer are pretty potato. Notion stores selection as grapheme indexes in a text property, so while it won’t lose selection if someone adds/removed characters from a text, your selection won’t make as much sense as one in Google Docs. Likewise with undo/redo or regular typing into the same field - it’s all last-write-wins updates. On the other hand, Notion’s editor does a much better job with CJK input, Android, etc compared to Slate. Slate has a beautiful API design but its implementation suffers outside of ideal conditions. Source: I built this: https://twitter.com/jitl/status/1483918085384028163?s=46&t=SvntQAbT_miucuAq6v9qnA https://twitter.com/jitl/status/1483918085384028163?s=46&t=S...
- stevenfabre 4y agoAwesome to hear from the Notion team who really gets this deeply. Slate definitely has its own limitations, especially when used on non desktop devices. Seems like ProseMirror would be a good open source alternative to Slate, what do you think?
- jitl 4y agoProseMirror did the best the last time I tested these libraries. TipTap (a competitor of yours?) provides an API layer on top, which I haven’t spent much time investigating. For my purpose I don’t want intermediary abstractions - but might be useful for your context depending on how much you want to specialize in rich text.
- stevenfabre 4y agoThank you. I think you misunderstood me. By extra pluming I meant: extra pluming on the block-based text editor as it is. Supporting multiplayer collaboration at the character level is much more difficult and we’re very well aware of that :)