Skip to content

Commit cc5e107

Browse files
committed
Merge branch 'master' into docs/beta-features/widget-variable-types
2 parents 3f9e426 + dffeaea commit cc5e107

File tree

8 files changed

+111
-87
lines changed

8 files changed

+111
-87
lines changed

packages/decap-cms-locales/src/zh_Hans/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,8 @@ const zh_Hans = {
9393
},
9494
i18n: {
9595
writingInLocale: '正在使用%{locale}撰写',
96+
copyFromLocale: '用其他语言进行填充',
97+
copyFromLocaleConfirm: '你确定要用“%{locale}”进行填充吗?\n这将会覆盖所有现有的内容。',
9698
},
9799
},
98100
editor: {

packages/decap-cms-locales/src/zh_Hant/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,8 @@ const zh_Hant = {
8787
},
8888
i18n: {
8989
writingInLocale: '以 %{locale} 書寫',
90+
copyFromLocale: '用其他語言進行填充',
91+
copyFromLocaleConfirm: '你確定要用“%{locale}”進行填充嗎?\n這將會覆蓋所有現有的內容。',
9092
},
9193
},
9294
editor: {

website/content/docs/beta-features.md

-86
Original file line numberDiff line numberDiff line change
@@ -9,35 +9,6 @@ We run new functionality in an open beta format from time to time. That means th
99

1010

1111

12-
13-
14-
15-
## Custom Mount Element
16-
17-
Decap CMS always creates its own DOM element for mounting the application, which means it always takes over the entire page, and is generally inflexible if you're trying to do something creative, like injecting it into a shared context.
18-
19-
You can now provide your own element for Decap CMS to mount in by setting the target element's ID as `nc-root`. If Decap CMS finds an element with this ID during initialization, it will mount within that element instead of creating its own.
20-
21-
22-
23-
24-
25-
## Image widget file size limit
26-
27-
You can set a limit to as what the maximum file size of a file is that users can upload directly into a image field.
28-
29-
Example config:
30-
31-
```yaml
32-
- label: 'Featured Image'
33-
name: 'thumbnail'
34-
widget: 'image'
35-
default: '/uploads/chocolate-dogecoin.jpg'
36-
media_library:
37-
config:
38-
max_file_size: 512000 # in bytes, only for default media library
39-
```
40-
4112
## Summary string template transformations
4213

4314
You can apply transformations on fields in a summary string template using filter notation syntax.
@@ -59,64 +30,7 @@ collections:
5930
The above config will transform the title field to uppercase and format the date field using `YYYY-MM-DD` format.
6031
Available transformations are `upper`, `lower`, `date('<format>')`, `default('defaultValue')`, `ternary('valueForTrue','valueForFalse')` and `truncate(<number>)`/`truncate(<number>, '<string>')`
6132

62-
## Registering to CMS Events
63-
64-
You can execute a function when a specific CMS event occurs.
65-
66-
Example usage:
67-
68-
```javascript
69-
CMS.registerEventListener({
70-
name: 'prePublish',
71-
handler: ({ author, entry }) => console.log(JSON.stringify({ author, data: entry.get('data') })),
72-
});
73-
```
74-
75-
Supported events are `prePublish`, `postPublish`, `preUnpublish`, `postUnpublish`, `preSave` and `postSave`. The `preSave` hook can be used to modify the entry data like so:
76-
77-
```javascript
78-
CMS.registerEventListener({
79-
name: 'preSave',
80-
handler: ({ entry }) => {
81-
return entry.get('data').set('title', 'new title');
82-
},
83-
});
84-
```
85-
86-
## Dynamic Default Values
87-
88-
When linking to `/admin/#/collections/posts/new` you can pass URL parameters to pre-populate an entry.
89-
90-
For example given the configuration:
91-
92-
```yaml
93-
collections:
94-
- name: posts
95-
label: Posts
96-
folder: content/posts
97-
create: true
98-
fields:
99-
- label: Title
100-
name: title
101-
widget: string
102-
- label: Object
103-
name: object
104-
widget: object
105-
fields:
106-
- label: Title
107-
name: title
108-
widget: string
109-
- label: body
110-
name: body
111-
widget: markdown
112-
```
113-
114-
clicking the following link: `/#/collections/posts/new?title=first&object.title=second&body=%23%20content`
115-
116-
will open the editor for a new post with the `title` field populated with `first`, the nested `object.title` field
117-
with `second` and the markdown `body` field with `# content`.
11833

119-
**Note:** URL Encoding might be required for certain values (e.g. in the previous example the value for `body` is URL encoded).
12034

12135

12236
## Remark plugins
+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
title: Custom Mount Element
3+
weight: 90
4+
group: Customization
5+
---
6+
7+
Decap CMS always creates its own DOM element for mounting the application, which means it always takes over the entire page, and is generally inflexible if you're trying to do something creative, like injecting it into a shared context.
8+
9+
You can now provide your own element for Decap CMS to mount in by setting the target element's ID as `id="nc-root"`. If Decap CMS finds an element with this ID during initialization, it will mount within that element instead of creating its own.
10+
11+
This is useful if you want to create a wrapper around the CMS, like a custom header, footer, or sidebar.
12+
13+
**Example**
14+
15+
Adding the following div to `admin/index.html` will cause the CMS to load within it:
16+
17+
<div id="nc-root"></div>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
title: Dynamic Default Values
3+
group: Fields
4+
weight: 30
5+
---
6+
7+
When linking to `/admin/#/collections/posts/new` you can pass URL parameters to pre-populate an entry.
8+
9+
For example given the configuration:
10+
11+
```yaml
12+
collections:
13+
- name: posts
14+
label: Posts
15+
folder: content/posts
16+
create: true
17+
fields:
18+
- label: Title
19+
name: title
20+
widget: string
21+
- label: Object
22+
name: object
23+
widget: object
24+
fields:
25+
- label: Title
26+
name: title
27+
widget: string
28+
- label: body
29+
name: body
30+
widget: markdown
31+
```
32+
33+
clicking the following link: `/#/collections/posts/new?title=first&object.title=second&body=%23%20content`
34+
35+
will open the editor for a new post with the `title` field populated with `first`, the nested `object.title` field
36+
with `second` and the markdown `body` field with `# content`.
37+
38+
**Note:** URL Encoding might be required for certain values (e.g. in the previous example the value for `body` is URL encoded).
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Registering to CMS Events
3+
weight: 80
4+
group: Customization
5+
---
6+
7+
You can execute a function when a specific CMS event occurs.
8+
9+
Example usage:
10+
11+
```javascript
12+
CMS.registerEventListener({
13+
name: 'prePublish',
14+
handler: ({ author, entry }) => console.log(JSON.stringify({ author, data: entry.get('data') })),
15+
});
16+
```
17+
18+
Supported events are `prePublish`, `postPublish`, `preUnpublish`, `postUnpublish`, `preSave` and `postSave`. The `preSave` hook can be used to modify the entry data like so:
19+
20+
```javascript
21+
CMS.registerEventListener({
22+
name: 'preSave',
23+
handler: ({ entry }) => {
24+
return entry.get('data').set('title', 'new title');
25+
},
26+
});
27+
```

website/content/docs/widgets/file.md

+12
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@ The file widget allows editors to upload a file or select an existing one from t
2929
config:
3030
multiple: true
3131
```
32+
33+
### File Size Limit
34+
35+
You can set a limit to as what the maximum file size of a file is that users can upload directly into a file field.
36+
37+
**Example**
38+
39+
```yaml
40+
media_library:
41+
config:
42+
max_file_size: 1024000 # in bytes, only for default media library
43+
```

website/content/docs/widgets/image.md

+13-1
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,16 @@ The image widget allows editors to upload an image or select an existing one fro
2828
media_library:
2929
config:
3030
multiple: true
31-
```
31+
```
32+
33+
### Image Size Limit
34+
35+
You can set a limit to as what the maximum file size of a file is that users can upload directly into a image field.
36+
37+
**Example**
38+
39+
```yaml
40+
media_library:
41+
config:
42+
max_file_size: 512000 # in bytes, only for default media library
43+
```

0 commit comments

Comments
 (0)