YText toJSON() and toString() producing the same result?

Hi folks!

I’m using the CALLBACK_URL functionality included in y-websocket. I’m trying to receive a full representation of richtext in the YText object that was just modified, including attributes. However, the toJSON() function that the callback calls on the YText produces a string with no attributes. It’s the same string toString() produces.

Am I doing something wrong here, or how do I get the full attribute representation of YText richtext?

Thanks for any help!

Hi @tambo,

You are doing nothing wrong. This feature was just not part of the initial feature-implementation of CALLBACK_URL. Most people probably should fork the y-websocket server. If you want to extract the attributes of a Y.Text, you should fork the server and call text.toDelta() instead.

While the default y-websocket server is by design quite minimal, the server provides much more features. Maybe it is something that you could check out.

1 Like