👀 Our most exciting product launch yet 🚀 Join us May 8th for Sanity Connect

Style Change in Block Editor Producing Wrong Tag

4 replies
Last updated: Feb 24, 2022
Hello, I’ve added a small item to our styles in our block editor:
  {title: 'Small', value: 'small', blockEditor: { 
    icon: () => <div>Small</div>, 
      render: ({children}) => <span><small>{children}</small></span>
  }}
But the value produced when fetching the data is just a normal
<p>
tag, is there something I’m missing? Thanks!
Feb 24, 2022, 3:24 PM
const smallStyle = (props) => (
  <span>
    {props.children}
  </span>
);

title: {
    title: "Small",
    value: "small",
    blockEditor: {
      render: smallStyle,
    },
  },

Feb 24, 2022, 3:29 PM
Changed it to an decorator instead, worked better, thanks!
Feb 24, 2022, 3:32 PM
Are you placing it inside the
decorators
?
Feb 24, 2022, 3:33 PM
Yes 🙂 Great.
Feb 24, 2022, 3:33 PM

Sanity– build remarkable experiences at scale

Sanity is a modern headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?