feat: local backup enhancements (#714)
This commit is contained in:
committed by
GitHub
parent
39bb9647b2
commit
804c09415b
@ -300,3 +300,7 @@ _This setting is required._
|
||||
The `collections` setting is the heart of your Static CMS configuration, as it determines how content types and editor fields in the UI generate files and content in your repository. Each collection you configure displays in the left sidebar of the Content page of the editor UI, in the order they are entered into your Static CMS `config` file.
|
||||
|
||||
`collections` accepts a list of collection objects. See [Collections](/docs/collection-overview) for details.
|
||||
|
||||
## Disable Local Backup
|
||||
|
||||
When the `disable_local_backup` setting is set to `true` local backups will no be taken for your entries and you will not be prompted to load local backups.
|
||||
|
@ -42,10 +42,7 @@ The following parameters will be passed to your `react_component` during render:
|
||||
|
||||
```js
|
||||
const PostPreview = ({ widgetFor, entry, collection, fields }) => {
|
||||
const imageField = useMemo(() =>
|
||||
fields.find(field => field.name === 'image'),
|
||||
[fields],
|
||||
);
|
||||
const imageField = useMemo(() => fields.find(field => field.name === 'image'), [fields]);
|
||||
const imageUrl = useMediaAsset(entry.data.image, collection, imageField, entry);
|
||||
|
||||
return h(
|
||||
@ -64,10 +61,7 @@ CMS.registerPreviewTemplate('posts', PostPreview);
|
||||
import CMS, { useMediaAsset } from '@staticcms/core';
|
||||
|
||||
const PostPreview = ({ widgetFor, entry, collection, fields }) => {
|
||||
const imageField = useMemo(() =>
|
||||
fields.find(field => field.name === 'image'),
|
||||
[fields],
|
||||
);
|
||||
const imageField = useMemo(() => fields.find(field => field.name === 'image'), [fields]);
|
||||
const imageUrl = useMediaAsset(entry.data.image, collection, imageField, entry);
|
||||
|
||||
return (
|
||||
@ -97,10 +91,7 @@ interface Post {
|
||||
}
|
||||
|
||||
const PostPreview = ({ widgetFor, entry, collection, fields }: TemplatePreviewProps<Post>) => {
|
||||
const imageField = useMemo(() =>
|
||||
fields.find(field => field.name === 'image'),
|
||||
[fields],
|
||||
);
|
||||
const imageField = useMemo(() => fields.find(field => field.name === 'image'), [fields]);
|
||||
const imageUrl = useMediaAsset(entry.data.image, collection, imageField, entry);
|
||||
|
||||
return (
|
||||
@ -355,12 +346,13 @@ CMS.registerPreviewStyle('.main { color: blue; border: 1px solid gree; }', { raw
|
||||
|
||||
The following parameters will be passed to your `react_component` during render:
|
||||
|
||||
| Param | Type | Description |
|
||||
| ---------- | ---------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| entry | object | Object with a `data` field that contains the current value of all widgets in the editor |
|
||||
| widgetFor | Function | Given a field name, returns the rendered preview of that field's widget and value |
|
||||
| widgetsFor | Function | Given a field name, returns the rendered previews of that field's nested child widgets and values |
|
||||
| theme | 'light'<br />\| 'dark' | The current theme being used by the app |
|
||||
| Param | Type | Description |
|
||||
| -------------- | ---------------------- | ------------------------------------------------------------------------------------------------- |
|
||||
| entry | object | Object with a `data` field that contains the current value of all widgets in the editor |
|
||||
| widgetFor | Function | Given a field name, returns the rendered preview of that field's widget and value |
|
||||
| widgetsFor | Function | Given a field name, returns the rendered previews of that field's nested child widgets and values |
|
||||
| theme | 'light'<br />\| 'dark' | The current theme being used by the app |
|
||||
| hasLocalBackup | boolean | Whether the current entry has a local backup |
|
||||
|
||||
#### Example
|
||||
|
||||
|
Reference in New Issue
Block a user