y-crdt / ydotnet

.NET bindings for yrs.
MIT License
36 stars 8 forks source link

How to get all the deltas from a given shared type? #104

Open jannikbuschke opened 2 months ago

jannikbuschke commented 2 months ago

Hello, thanks for this good looking project!

Given an XmlText, how to get all the deltas? In yjs an YXmlText has a method toDelta() which seems to give a list of all the changes if I am not mistaken. I dont see such a method on the dotnet types? Is this missing or implemented somewhere else?

SebastianStehle commented 2 months ago

Hi, I think yrs just does not implement this method.

Horusiath commented 2 months ago

@jannikbuschke @SebastianStehle yrs has this method, it's called Text::diff.

SebastianStehle commented 2 months ago

Thank you, but I don't see it in yffi: https://github.com/y-crdt/y-crdt/blob/main/yffi/src/lib.rs

Horusiath commented 2 months ago

If that's the case, I'll try to add it to yffi before next release.

jannikbuschke commented 2 months ago

I thought I found another way to accomplish my current thing, but actually the delta seems to be important for getting the embeds out of an XML Text. At least I did not yet found another way.

Horusiath commented 2 months ago

@SebastianStehle @jannikbuschke from what I've checked, yffi already has necessary API -> ytext_chunks. Atm. you cannot insert series of formatted text chunks using yffi, as it's a little bit more complicated, but we'll get there as well.

Horusiath commented 2 months ago

Update: yffi v0.20 now allows to insert text deltas as well. Read release docs for changes and see tests (I've added quite a few of them) for example usage and new features.

jannikbuschke commented 1 month ago

@SebastianStehle would love if this could be added to ydotnet 🙏

SebastianStehle commented 1 month ago

Sure. Not sure when I have time for that. A PR would also be welcome.