I try adding indentations but it just jumps to the publish button

6 replies
Last updated: Feb 4, 2021

I try adding these indentations, but when I hit tab, it just jumps to the publish button instead of indenting

Feb 2, 2021, 2:27 PM

Hi Brian, these seem to clash with the studio's own keyboard navigation. I'm checking if we have any other way to get them to work.

Feb 2, 2021, 3:02 PM

Much appreciated

Feb 2, 2021, 3:05 PM

Just got word back from our product design team. Unfortunately, it seems like we don't support them at the moment. Noting this down as a feature request.

Feb 2, 2021, 3:10 PM

Sounds good, thanks for the help!

Feb 2, 2021, 3:11 PM

Hi Brian. What follows doesn’t solve your request for tab indentations, but if you only need to indent once, you could add something like this to your schema styles:

{
  title: "Indented",
  value: "indented",
  blockEditor: {
    render: ({ children}) => <p style={{ marginLeft: "2em" }}>{children}</p>
  }
},
Then on your front end (assuming you want the indents to render out), you could add to your serializer. Something like:


import BlockContent from '@sanity/block-content-to-react';

...

const serializers = {
  types: {
    block: (props) => {
      const { style = 'normal' } = props.node;
      if (style === 'indented') return <p style={{ marginLeft: "2em" }}>{props.children}</p>;
      return BlockContent.defaultSerializers.types.block(props);
    },
    …
  },
  ...
}

Feb 4, 2021, 4:26 PM

Ahhh that can work, thanks!

Feb 4, 2021, 5:02 PM

Sanity.io: Get the most out of your content

Sanity.io is a platform to build websites and applications. It comes with great APIs that let you treat content like data. Give your team exactly what they need to edit and publish their content with the customizable Sanity Studio. Get real-time collaboration out of the box. Sanity.io comes with a hosted datastore for JSON documents, query languages like GROQ and GraphQL, CDNs, on-demand asset transformations, presentation agnostic rich text, plugins, and much more.

Don't compromise on developer experience. Join thousands of developers and trusted companies and power your content with Sanity.io. Free to get started, pay-as-you-go on all plans.