Sanity Studio v5.6.0: New customization options for document UI and portable text, plus stability and performance improvements

Add custom components without changing the data schema

In instances where you want to add UI to an object or fieldset, but not tied to the schema shape, the new renderMembers function enables developers to inject decorative elements (custom UI components) into document forms without persisting data the data in Content Lake.

// ... surrounding type
defineField({
name: 'settings',
type: "object",
title: 'Settings',
renderMembers: (members) => {
return [
...members,
// Adds the decoration component after all the fields members
{
key: 'decoration',
kind: 'decoration',
component: () => <DecorationComponent />,
},
]
},
})

You can now import the default PTE annotations and decorators

When customizing the Portable Text Editor (block content), you can now import DEFAULT_ANNOTATIONS and DEFAULT_DECORATORS from sanity package to extend block content while preserving built-in link annotation and text decorators.

import {defineType, defineArrayMember, DEFAULT_ANNOTATIONS,
DEFAULT_DECORATORS} from 'sanity'

export default defineType({
name: 'content',
title: 'Content',
type: 'array',
of: [
defineArrayMember({
type: 'block',
marks: {
decorators: [
// Spread the default decorators
...DEFAULT_DECORATORS,
// ... your custom decorators
],
annotations: [
// Spread the default annoations
...DEFAULT_ANNOTATIONS,
// ... your custom annotations
]
}
})
]
})

🐛 Notable bugfixes and improvements

The codegen package adds Get and FilterByType for getting deep properties from generated types and making getting the type for a module in a typical page builder setup easier.

The timezone switch button now displays when allowTimeZoneSwitch: true is configured without displayTimeZone.

Fixes an issue to allow setting timezone to dates arrays.

Fixes an issue in where comments created by users with read only access inside a PTE field was not storing the text in where the comment was made.

Added ability to open Media Library assets in their original source directly from file and image input fields.

Fixes overlap of deprecated label with validation status icons in fields labels.

Fixes an issue where a path error would occur when running sanity dev on a Windows machine.

Fixes an issue where the published version of the document would not show when it was selected in the document form.

Annotation popovers are wider to provide adequate space for reference fields.

PTE custom toolbar icons now use the correct color token.

Fixes bug where using custom types directly in annotations within a portable text editor would cause a studio to crash.

Fixed an issue where private image assets would not load in self-hosted studios.

Reduced the loading times of public image assets in studios using cookie-based authentication.

Added indicators to private assets in studio inputs.

Improved error handling and UI feedback for private asset load failures when using an unsupported authentication mode.

Fixes an issue in where opening referenced documents could crash the studio if the perspective is published.