Skip to content

Instantly share code, notes, and snippets.

@TheEskhaton
Created June 2, 2020 09:38
Show Gist options
  • Save TheEskhaton/4155e6bb21c7b1f0c3df874cdca1c52f to your computer and use it in GitHub Desktop.
Save TheEskhaton/4155e6bb21c7b1f0c3df874cdca1c52f to your computer and use it in GitHub Desktop.
export default {
name: 'bodyPortableText',
type: 'array',
title: 'Post body',
of: [
{
type: 'block',
title: 'Block',
// Styles let you set what your user can mark up blocks with. These
// corrensponds with HTML tags, but you can set any title or value
// you want and decide how you want to deal with it where you want to
// use your content.
styles: [
{title: 'Normal', value: 'normal'},
{title: 'H1', value: 'h1'},
{title: 'H2', value: 'h2'},
{title: 'H3', value: 'h3'},
{title: 'H4', value: 'h4'},
{title: 'Quote', value: 'blockquote'}
],
lists: [{title: 'Bullet', value: 'bullet'}, {title: 'Number', value: 'number'}],
// Marks let you mark up inline text in the block editor.
marks: {
// Decorators usually describe a single property – e.g. a typographic
// preference or highlighting by editors.
decorators: [{title: 'Strong', value: 'strong'}, {title: 'Emphasis', value: 'em'}],
// Annotations can be any object structure – e.g. a link or a footnote.
annotations: [
{
name: 'link',
type: 'object',
title: 'URL',
fields: [
{
title: 'URL',
name: 'href',
type: 'url'
}
]
}
]
},
of: [{type: 'authorReference'}]
},
// You can add additional types here. Note that you can't use
// primitive types such as 'string' and 'number' in the same array
// as a block type.
{
type: 'mainImage',
options: {hotspot: true}
},
{
type: 'gist'
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment