sanity
Version:
Sanity is a real-time content infrastructure with a scalable, hosted backend featuring a Graph Oriented Query Language (GROQ), asset pipelines and fast edge caches
38 lines (32 loc) • 686 B
text/typescript
import {Schema} from '@sanity/schema'
import {defineArrayMember, defineField} from '@sanity/types'
export const mentionObject = defineField({
name: 'mention',
type: 'object',
fields: [
{
name: 'userId',
type: 'string',
},
],
})
const blockType = defineField({
type: 'block',
name: 'block',
of: [mentionObject],
marks: {
annotations: [],
},
styles: [{title: 'Normal', value: 'normal'}],
lists: [],
})
const portableTextType = defineArrayMember({
type: 'array',
name: 'body',
of: [blockType],
})
const schema = Schema.compile({
name: 'comments',
types: [portableTextType],
})
export const editorSchemaType = schema.get('body')