Installation and upgrading
To initiate a new Studio without installing the CLI globally:
npx create-sanity@latest
To upgrade a v3 Studio:
npm install sanity@latest
✨ Highlights
Improved customization and Typescript support for the Portable Text Input and schemas
Improved support for custom rendering of the content in the Portable Text input via .components.block
, component.inlineBlock
and .components.annotation
render callbacks for object-like schema types, references and type aliases.
While this has been possible previously by modifying the block schema locally, these customizations can now also be put directly on the various content types themselves, to be shared between different Portable Text inputs using them. For example you can now customize how an author reference would appear in various Portable Text contexts on the author schema itself.
Also text specific schema properties like decorators, styles and lists for the block type itself have slighly changed their configuration in order to better align with the rest of the studio. More info: Changes in block schema customization properties.
If you previously did customization of the editor using your own render callbacks or icons through the .blockEditor
property in the block schema, you will get a deprecation warning, but they will still continue to work until further notice.
Please refer to the documentation for how to customize the block type and the Portable Text editor for v3 of the studio.
Besides this, the Portable Text input related code and schema types have been given a Typescript update for better type safety and developer experience.
Studio appearance
The user menu now has options to select the apperance of the Studio. The selected appearance is stored in local storage and is reused on the next visit.
Logo component updates
The button in the navbar that wraps the custom logo component has no padding anymore. This update is made in order to give the custom logo component full control over how big the button in the navbar should be. Therefore, the custom logo component may need to be updated in order to achieve the previous look. Below is an example of how to recreate the same result as before:
import {defineConfig} from 'sanity'
import {Box} from '@sanity/ui'
function MyLogo() {
return (
<Box padding={3}> // <-- Wrap your custom logo with a `Box` with `padding={3}`
<CustomLogo />
</Box>
)
}
export default defineConfig({
// ... rest of config
studio: {
components: {
logo: MyLogo,
},
},
})
🐛 Notable bugfixes
- This update fixes so that the component in the root config (ie in
defineConfig
) is the component that receives the result of the props passed on withrenderDefault
in previous custom components. - Fixed an issue with custom sort orders
📓 Full changelog
Author | Message | Commit |
---|---|---|
Bjørge Næss | fix(form): fix issue with zero being rendered as empty string in number input | 7be7511 |
Marius Lundgård | build: add bin directory to distribution
| a1f6e00 |
Herman Wikner | feat(core): update user menu with color schemes | 788d23b |
Herman Wikner | feat(core): store selected color scheme i local storage | 9ce0108 |
Herman Wikner | fix(core): update workspace preview design | 543a0f3 |
Marius Lundgård | fix(config): respect unstable_clientFactory
| bcd4854 |
Cody Olsen | fix: optimize lodash imports (#3974) | 6c7d48d |
Marius Lundgård | docs: update readme (#3987) | 88c90eb |
Marius Lundgård | docs: remove ToC | 13389f5 |
Bjørge Næss | chore(form): replace react-sortable-hoc with dndkit (#3961) | 551c4d5 |
Espen Hovlandsdal | fix(cli): only require workspace name if more than 1 workspace | 743244b |
Espen Hovlandsdal | feat(core): add userHasRole utility method
| cd0819f |
Snorre Eskeland Brekke | fix(block-tools): ignore blocks inside list items (#3492) | 5e51831 |
Espen Hovlandsdal | feat(core): add new documentIdEquals utility method
| f7eb4b3 |
Espen Hovlandsdal | chore(vision): use react 18 compatible dependencies | 401f08a |
Espen Hovlandsdal | fix(config): throw error early if tools/template resolution fails | 2f2e467 |
Herman Wikner | fix(core): components API execution order | 299ac06 |
vicbergquist | fix(desk): always use default ordering on first rendering if any and update order on sort | 663cc67 |
Espen Hovlandsdal | refactor(desk): remove unused default ordering option in useDocumentList
| e2209ec |
Espen Hovlandsdal | fix(desk): recompute default sort order on desk structure change | 4f9a353 |
Espen Hovlandsdal | fix(desk): use last updated at as default sort order | d5166e5 |
Per-Kristian Nordnes | refactor(types): refactor Block schemas for new component extension api | dfd33ce |
Per-Kristian Nordnes | refactor(types): refactor portable text types used internally in the studio | 48c03a9 |
Per-Kristian Nordnes | refactor(types): remove deprecated block validator Rules from v2 | 7aa1404 |
Per-Kristian Nordnes | refactor(schema): allow for .components in block schema + ensure that the result has a name | 5b5e878 |
Per-Kristian Nordnes | refactor(validation): remove deprecated block validation rule. Should be using 'Rule.custom' in v3. | 5f92213 |
Per-Kristian Nordnes | refactor(validation): update pt types | acc0e79 |
Per-Kristian Nordnes | refactor(core/form): add block and annotation component schema extensions | bbd32ae |
Per-Kristian Nordnes | refactor(block-tools): use pt-types from @sanity/types | 27d5133 |
Per-Kristian Nordnes | refactor(form/inputs): Custom rendering support via schema for PT-input | f1152f7 |
Per-Kristian Nordnes | refactor(core/fields/diffs): use new types in Portable-text-diffs | b2aa1f2 |
Per-Kristian Nordnes | refactor(core/preview): use new types in portable-text previews | 3fd22cc |
Per-Kristian Nordnes | refactor(core/form/inputs): function can now be moved out of scope | ccdc0fd |
Per-Kristian Nordnes | refactor(core/form/inputs): keep using schemaType var name | a65169b |
Per-Kristian Nordnes | refactor(core/form/input): use updated types for block schemas and pt render callbacks | aa3ee4e |
Per-Kristian Nordnes | refactor(types/schema): support seperate inlineBlock render callback | c21a8f1 |
Per-Kristian Nordnes | refactor(schema): validate lists and new component for block type | afd01e2 |
Per-Kristian Nordnes | refactor(types): limit supported types in block types .of to objects and refs | cb867b8 |
Per-Kristian Nordnes | refactor(core/form): update render callback support for block types | 0902fa5 |
Per-Kristian Nordnes | chore: mark types required (by schemas) as @beta | edb3bd0 |
Per-Kristian Nordnes | refactor(portable-text-editor): update types and add render callbacks to the PTE | 6202a8c |
Per-Kristian Nordnes | chore: update puppeteer to latest version | a9dc1ea |
Per-Kristian Nordnes | test(portable-text-editor): update tests | 05abec0 |
Per-Kristian Nordnes | chore: update yarn.lock | 0590a81 |
Per-Kristian Nordnes | chore(portable-text-editor): mark types with availablility status | 3408962 |
Per-Kristian Nordnes | refactor(portable-text-editor): simplify code | 8c08f85 |
Per-Kristian Nordnes | refactor(portable-text-editor): rename type > schemaType | d25cbb5 |
Per-Kristian Nordnes | refactor(portable-text-editor): rename type > schemaType | b18716f |
Per-Kristian Nordnes | feature(schema): backward compatibility for breaking changes in block schema | c323b12 |
Bjørge Næss | fix(schema): add help id to blockeditor schema warnings | 8d74ace |
Herman Wikner | feat(core): move padding from LogoButton to StudioLogo
| d774bc6 |
Herman Wikner | dev(test-studio): update custom logo component | bb61fa1 |
Marius Lundgård | fix: pass readOnly to select element (#3900)
| f70736f |