strapi / blocks-react-renderer

A React renderer for the Strapi's Blocks rich text editor
Other
162 stars 25 forks source link

feat: add plainText to headings #28

Open benjaminrobinet opened 8 months ago

benjaminrobinet commented 8 months ago

What does it do?

It allows to have access to the plainText of a heading block.

Why is it needed?

Sometimes you might want to have access to the plain text of a heading to be able to add an attribute to it, like for creating anchors to point to them.

How to test it?

In a frontend app, use the renderer (link it via yarn), and pass a custom component for heading that uses the plainText prop

Related issue(s)/PR(s)

Inspired by https://github.com/strapi/blocks-react-renderer/pull/17

benjaminrobinet commented 8 months ago

I'm gonna push a fix for that today ! Was thinking if it wouldn't be interesting to also pass the raw object (from the strapi response) to every block types. For now, we only have access to the React.Node

benjaminrobinet commented 7 months ago

no feedback on this @remidej ? any chance this get merged ? :)