Greetings,
Does anyone know of a way to set a text field in ShareDB by its diff (difference) with the old text?
I've got a scenario where I want to set the value of a string in ShareDB, but also minimize the size of the ops (for history retention). I know the old string value, and the new string value, but the edit is not from a text editor so I don't know the minimal ops to generate for the change. The strings are datasets such as CSV or JSON strings, and the changes are updates to the datasets. The most common types of changes are appending new lines at the end, and removing lines from the beginning, but these are not the only kinds of changes encountered.
I'm looking for something that computes a String diff like
Google Diff Match Patch or
JSDiff, but which generates ShareDB ops instead of library-specific diff data structures. I suppose a direct conversion from the diff library output to JSON0 ops may be possible, but I'm not sure.
Thanks!
Best regards,
Curran