Block
Block
The Block
component is used for wrapping fields in BlockRepeater
, BlockEditor
or DiscriminatedBlocks
components.
Loading...
Props
Prop | Description |
---|---|
| OptionallyVariableFieldValue Field to discriminate by. Required |
| ReactNode The label for the field. |
| ReactNode The description for the field. |
| ReactNode |
| Renders content of the component. |
Block in BlockEditor
- Component
- Schema
Loading...
export class BlockEditor {
blocks = def.oneHasMany(ContentBlock, 'blockEditor')
}
export class ContentBlock {
order = def.intColumn().notNull()
type = def.enumColumn(ContentBlockType).notNull()
content = def.stringColumn()
blockEditor = def.manyHasOne(BlockEditor, 'blocks')
references = def.oneHasMany(ContentReference, 'contentPart')
}
export class ContentReference {
type = def.enumColumn(def.createEnum('gallery')).notNull()
contentPart = def.manyHasOne(ContentBlock, 'references')
content = def.stringColumn()
author = def.stringColumn()
images = def.oneHasMany(ContentGallery, 'contentReference')
}
export class ContentGallery {
order = def.intColumn().notNull()
image = def.manyHasOne(Image).notNull()
contentReference = def.manyHasOne(ContentReference, 'images').cascadeOnDelete()
}