pycrdt icon indicating copy to clipboard operation
pycrdt copied to clipboard

Support for Attributes of Any Type in XML Objects

Open carlosleandr opened this issue 1 year ago • 1 comments

Problem

Would it be possible to implement the storage of attributes of any type similar to what the Yjs package does? For example, you can see Yjs's implementation here:

https://github.com/yjs/yjs/blob/8dc1296a0bd15e70c573160593c2617e0d772f01/src/types/YText.js#L1235-L1268

Currently, more complex attributes from the Yjs package are arriving in the pycrdt package as strings, making it impossible to retrieve them properly. Check the details in the following references:

https://github.com/jupyter-server/pycrdt/blob/2518513b7c17073fcde70f194435358aa9cd2b8a/python/pycrdt/_pycrdt.pyi#L300-L307

https://github.com/jupyter-server/pycrdt/blob/2518513b7c17073fcde70f194435358aa9cd2b8a/src/xml.rs#L76-L94

Additional context

Here is an example of an attribute that I find difficult to retrieve properly due to the various possibilities of values and data organization:

tokens = "[{text: welcome, start: 55, end: 56.4567498}, {start: 56.4567498, text: feature:, end: 60.11}, {start: 60.11, end: 65.0001, text: 12.4564}]"```

carlosleandr avatar Oct 31 '24 15:10 carlosleandr

I would have to look into it, but maybe @ColonelThirtyTwo has ideas?

davidbrochart avatar Oct 31 '24 16:10 davidbrochart

Fixed in #276.

davidbrochart avatar Jul 09 '25 12:07 davidbrochart