UNPKG

@portabletext/editor

Version:

Portable Text Editor made in React

22 lines (20 loc) 554 B
import type {PortableTextSpan} from '@sanity/types' import type {EditorContext} from '../editor/editor-snapshot' export function createPlaceholderBlock( context: Pick<EditorContext, 'keyGenerator' | 'schema'>, ) { return { _type: context.schema.block.name, _key: context.keyGenerator(), style: context.schema.styles[0].name ?? 'normal', markDefs: [], children: [ { _type: context.schema.span.name, _key: context.keyGenerator(), text: '', marks: [], } as PortableTextSpan, ], } }