sanity-io / block-content-to-react

Deprecated in favor of @portabletext/react
https://github.com/portabletext/react-portabletext
MIT License
161 stars 25 forks source link

Is there a way to just return from a serializer? #19

Closed vongohren closed 5 years ago

vongohren commented 5 years ago

I have a case where I want to serialze a special style inside the block type. But I want to return default rendering of all other styles. I dont want to have to write the serializer for all styles inside the block

How can I do this?

bjoerge commented 5 years ago

Hi @vongohren. It's possible to delegate to BlockContent.defaultSerializers:

Check out this test for an example: https://github.com/sanity-io/block-content-to-react/blob/a41894874c0ca7b7aa06e6ac3fa143cdd950c657/test/dom/BlockContent.test.js#L60-L70

vongohren commented 5 years ago

Cool, thank you :D

On Fri, Jul 19, 2019 at 1:00 PM Bjørge Næss notifications@github.com wrote:

Closed #19 https://github.com/sanity-io/block-content-to-react/issues/19 .

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sanity-io/block-content-to-react/issues/19?email_source=notifications&email_token=AAHXCV445R2UK2EWMYBLKATQAGNDRA5CNFSM4IEOODFKYY3PNVWWK3TUL52HS4DFWZEXG43VMVCXMZLOORHG65DJMZUWGYLUNFXW5KTDN5WW2ZLOORPWSZGOSS7C6WY#event-2495491931, or mute the thread https://github.com/notifications/unsubscribe-auth/AAHXCV46EBDPEXHP26JVGVDQAGNDRANCNFSM4IEOODFA .