Issue with italics not working in portable text editor, resolved by removing CSS override.
I understand you're experiencing an issue where italics aren't working in your portable text editor, even though bold is working fine. This is actually a common configuration issue, and you're not alone in experiencing this!
Based on the standard portable text configuration, both bold (strong) and italics (em) should be included by default. However, if you're using a custom blockContent schema, you might have accidentally overridden the default decorators.
Check Your Schema Configuration
If you've customized your block content schema and explicitly defined the decorators array under marks, you need to make sure the em decorator is included. Here's what a proper configuration should look like:
{
name: 'content',
type: 'array',
of: [
{
type: 'block',
marks: {
decorators: [
{title: 'Strong', value: 'strong'},
{title: 'Emphasis', value: 'em'}, // Make sure this is included!
{title: 'Code', value: 'code'}
]
}
}
]
}Common Causes
- Custom decorator configuration: If you've defined a custom
decoratorsarray but forgot to include{title: 'Emphasis', value: 'em'}, italics won't appear in the toolbar - Partial override: Sometimes when customizing one aspect of marks (like adding custom decorators), you accidentally replace the entire default configuration instead of extending it
Solution
Make sure your schema includes the em decorator. If you're not seeing the italics button in your toolbar, add it explicitly to your marks configuration.
The default decorators that come with portable text are:
strong(bold)em(italics/emphasis)code(inline code)underlinestrike-through
Important: When you define a custom decorators array, it completely replaces the defaults. So if you've added custom decorators, you need to include all the default ones you want to keep alongside your custom ones.
Try adding the em decorator back to your configuration and restart your Studio. That should resolve the issue! If you're still having trouble, feel free to share your schema code and I can help identify the specific issue.
Sanity – Build the way you think, not the way your CMS thinks
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.