blocks-react-renderer icon indicating copy to clipboard operation
blocks-react-renderer copied to clipboard

feat: add plainText to headings

Open benjaminrobinet opened this issue 1 year ago • 2 comments

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 avatar Mar 13 '24 16:03 benjaminrobinet

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 avatar Mar 14 '24 08:03 benjaminrobinet

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

benjaminrobinet avatar Apr 15 '24 15:04 benjaminrobinet