feat(cabana): code editor, colour and mail image fields, mail branding and the image library
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -107,12 +107,16 @@ for _, f := range form.Fields {
|
||||
| `repeater` | A list of rows, each with its own small form, stored as JSON in one column; see [Repeater](#repeater). |
|
||||
| `money` | An exact decimal amount with a currency suffix, never a float and never rounded; see [Money](#money). |
|
||||
| `taglist` | A list of tags edited as chips, stored as a JSON array or as one separator-joined string; see [Taglist](#taglist). |
|
||||
| `codeeditor` | A source editor for HTML, CSS or plain text (`language` required: `html`, `css` or `text`); optional `size` and `mailImages: true` for the mail image insert control. |
|
||||
| `colorpicker` | A `#rrggbb` colour (or empty); Winter's `availableColors` is not supported. Invalid colours are a 422 with `backend::lang.colorpicker.invalid`. |
|
||||
| `mailimage` | A single image chosen from the mail image library (stores a file id). Missing library images are a 422 with `backend::lang.mailimage.missing`. |
|
||||
| `mailpreview` | A valueless live preview control (`mode` required: `template`, `layout`, `partial` or `branding`); never bound or accepted in a save body. |
|
||||
|
||||
The WinterCMS widgets that are not in this list (the code editor, the color picker, the media finder and the others) are not provided. A field with one of those types stops the start-up, unless a plugin registers that alias as its own field type: plugins add field types with a custom element and Go code that decides what is stored; see [Plugin field types](field-types.md).
|
||||
|
||||
### Field options
|
||||
|
||||
A field takes `label`, `comment`, `type`, `required`, `default`, `tab`, `span` (`left`, `right`, `full`, `auto`, `row`), `size` (`tiny`, `small`, `large`, `huge`, `giant`), `context`, `attributes` (scalar HTML attributes for the input), `options` and `emptyOption`, plus `nameFrom` and `relation` on relation fields, `preset` on text and mltext fields, `dependsOn` on dropdowns (see [Dependent dropdowns](#dependent-dropdowns)), `currency`, `currencyFrom`, `scale` and `max` on money fields (see [Money](#money)), `mode`, `separator` and `customTags` on taglist fields (see [Taglist](#taglist)), and `trigger` (see [Triggers](#triggers)). WinterCMS keys outside this set, such as `readOnly` or `disabled`, are refused.
|
||||
A field takes `label`, `comment`, `type`, `required`, `default`, `tab`, `span` (`left`, `right`, `full`, `auto`, `row`), `size` (`tiny`, `small`, `large`, `huge`, `giant`), `context`, `attributes` (scalar HTML attributes for the input), `options` and `emptyOption`, plus `nameFrom` and `relation` on relation fields, `preset` on text and mltext fields, `dependsOn` on dropdowns (see [Dependent dropdowns](#dependent-dropdowns)), `currency`, `currencyFrom`, `scale` and `max` on money fields (see [Money](#money)), `mode`, `separator` and `customTags` on taglist fields (see [Taglist](#taglist)), `language` and `mailImages` on `codeeditor` (and `mailImages` on `markdown`), `mode` on `mailpreview`, and `trigger` (see [Triggers](#triggers)). WinterCMS keys outside this set, such as `readOnly` or `disabled`, are refused.
|
||||
|
||||
`context: update` shows a field only on the update form, and `context: create` only on the create form; a list of contexts is also accepted, and `context: preview` shows a field only on the [preview screen](#preview-screen). The context is enforced on the server too: a field that is hidden on a form is never written by that form's save, whatever the request body holds.
|
||||
|
||||
|
||||
Reference in New Issue
Block a user