type
Config
Choose a rich-text field's editing tools, allowed collections, blocks, and admin presentation.
Example
richtext.Field("content", richtext.Config{
UploadCollections: []string{"media"},
Admin: richtext.Admin{FixedToolbar: true},
}).Required()Properties
| Property | Type | Description |
|---|---|---|
Blocks | []field.Block | Block definitions owned by this field. Enables the block tools. |
BlockReferences | []string | Slugs of blocks registered in the root Config.Blocks. Use this or Blocks, not both. |
Features | []Feature | Optional editing tools. Nil keeps the defaults; an empty slice disables every optional tool. |
UploadCollections | []string | Upload collections the media picker and validation allow. Empty allows every compatible collection. |
RelationshipCollections | []string | Collections the relationship picker and validation allow. Empty allows every compatible collection. |
Admin | Admin | Toolbar and layout options for the admin editor. The zero value keeps every default. |
How it works
A nil Features slice inherits defaults; an explicit empty slice disables every optional feature. Empty collection allowlists permit every compatible collection, while non-empty lists restrict node targets.
Full signature
type Config struct {
// Blocks is the fixed executable schema allowlist. Fields are resolved
// through the public embedded-fields contract, never serialized as settings.
Blocks []field.Block `json:"-"`
// BlockReferences selects Config.Blocks definitions; it is exclusive with Blocks.
BlockReferences []string `json:"-"`
Features []Feature `json:"features"`
UploadCollections []string `json:"uploadCollections,omitempty"`
RelationshipCollections []string `json:"relationshipCollections,omitempty"`
// Admin changes how the editor looks and behaves in the admin. It never
// changes what a document can store.
Admin Admin `json:"admin,omitzero"`
}