m4rvr / storyblok-rich-text-renderer

Fast renderer for your rich-text content.
35 stars 15 forks source link

Possibility to pass props to (default) resolver #6

Open m4rvr opened 4 years ago

m4rvr commented 4 years ago

Is your feature request related to a problem? Please describe. At the moment you can only override a resolver but it's not possible to pass props like class to it. This is especially needed with tailwindcss to add classes to those components.

Describe the solution you'd like Provide the possibility to define the resolver as an object with the optional component (the component for overriding the default resolver) and props (all props passed directly to the resolver). It should be still possible to override the resolver directly without an object definition.

Suggestion:

{
  resolvers: {
    blocks: {
      [Block.PARAGRAPH]: {
        component: CustomParagraph,
        props: {
          class: 'custom-classes',
          id: 'custom-id'
        }
      }
    }
  }
}

This should be still possible:

{
  resolvers: {
    blocks: {
      [Block.PARAGRAPH]: CustomParagraph
    }
  }
}