Closed haf closed 3 years ago
Hey @haf, can you give me more details of what you mean? Would you like to be able to specify your own serialize functions, like our serializeStandardTag
for example?
No, I don't, I mean exposing your existing per-type serialisation functions.
Ok, we can definitely do that. How would you make use of them?
I ended up copying your code instead; but what I would have done would have been to delegate to them from my own clone of your main serialise function, as to keep the behaviour the same for everything except the single serialisation function I wished to override.
The use case was rendering NextJS links.
Ok, it definitely makes sense!
Have you tried using the elements
property?
<RichText render={myField} elements={{ hyperlink: () => <NextLink /> }}
I think I tried it, but it’s been too long and I don’t remember why I didn’t use it. Sorry
haha no problem, we added the prop not so long ago, it may even not have been available at the time! Thanks for your contribution ✌️
If I'm supposed to be able to override singular element type serialisation functions, it would be great to be able to delegate all other types of elements into this code-base. Hence; if you could expose your serialisers, it would be appreciated.