docs: updates code and json field types to reflect internal switch to monaco-react editor

This commit is contained in:
Jarrod Flesch
2023-01-03 15:01:04 -05:00
parent 4d74d7a994
commit f7d664fdcf
2 changed files with 66 additions and 15 deletions

View File

@@ -11,7 +11,7 @@ keywords: code, fields, config, configuration, documentation, Content Management
The Code field type saves a string in the database, but provides the Admin panel with a code editor styled interface.
</Banner>
This field uses `prismjs` for syntax highlighting and `react-simple-code-editor` for the editor itself.
This field uses the `monaco-react` editor syntax highlighting.
### Config
@@ -39,19 +39,7 @@ This field uses `prismjs` for syntax highlighting and `react-simple-code-editor`
In addition to the default [field admin config](/docs/fields/overview#admin-config), the Code field type also allows for the customization of a `language` property.
The following `prismjs` plugins are imported, enabling the `language` property to accept the following values:
| Plugin | Language |
| ---------------------------- | ----------- |
| **`prism-css`** | `css` |
| **`prism-clike`** | `clike` |
| **`prism-markup`** | `markup`, `html`, `xml`, `svg`, `mathml`, `ssml`, `atom`, `rss` |
| **`prism-javascript`** | `javascript`, `js` |
| **`prism-json`** | `json` |
| **`prism-jsx`** | `jsx` |
| **`prism-typescript`** | `typescript`, `ts` |
| **`prism-tsx`** | `tsx` |
| **`prism-yaml`** | `yaml`, `yml` |
The [monaco-react](https://github.com/suren-atoyan/monaco-react) editor supports all of the languages supported by the [monaco-editor](https://github.com/microsoft/monaco-editor). The `language` property can be set to any of the languages listed [here](https://github.com/microsoft/monaco-editor/tree/main/src/basic-languages).
### Example
@@ -67,7 +55,7 @@ const ExampleCollection: CollectionConfig = {
type: 'code', // required
required: true,
admin: {
language: 'js'
language: 'javascript'
}
}
]