Skip to content

Commit 09b2897

Browse files
authored
improve documentation for fields package (#67580)
1 parent e6f7b4f commit 09b2897

26 files changed

+79
-57
lines changed

packages/fields/README.md

+20-36
Original file line numberDiff line numberDiff line change
@@ -41,107 +41,91 @@ Date field for BasePost.
4141

4242
### deletePost
4343

44-
Undocumented declaration.
44+
Delete action for Templates, Patterns and Template Parts.
4545

4646
### duplicatePattern
4747

48-
Undocumented declaration.
48+
Duplicate action for Pattern.
4949

5050
### duplicatePost
5151

52-
Undocumented declaration.
53-
54-
### duplicatePostNative
55-
56-
Undocumented declaration.
52+
Duplicate action for BasePost.
5753

5854
### duplicateTemplatePart
5955

60-
This action is used to duplicate a template part.
61-
62-
_Type_
63-
64-
- `Action< TemplatePart >`
56+
Duplicate action for TemplatePart.
6557

6658
### exportPattern
6759

68-
Undocumented declaration.
69-
70-
### exportPatternNative
71-
72-
Undocumented declaration.
60+
Export action as JSON for Pattern.
7361

7462
### featuredImageField
7563

76-
Undocumented declaration.
64+
Featured Image field for BasePost.
7765

7866
### orderField
7967

80-
Undocumented declaration.
68+
Order field for BasePost.
8169

8270
### parentField
8371

84-
This field is used to display the post parent.
72+
Parent field for BasePost.
8573

8674
### passwordField
8775

88-
This field is used to display the post password.
76+
Password field for BasePost.
8977

9078
### permanentlyDeletePost
9179

92-
Undocumented declaration.
80+
Delete action for PostWithPermissions.
9381

9482
### PostType
9583

9684
Undocumented declaration.
9785

9886
### renamePost
9987

100-
Undocumented declaration.
88+
Rename action for PostWithPermissions.
10189

10290
### reorderPage
10391

104-
Undocumented declaration.
105-
106-
### reorderPageNative
107-
108-
Undocumented declaration.
92+
Reorder action for BasePost.
10993

11094
### resetPost
11195

112-
Undocumented declaration.
96+
Reset action for Template and TemplatePart.
11397

11498
### restorePost
11599

116-
Undocumented declaration.
100+
Restore action for PostWithPermissions.
117101

118102
### slugField
119103

120-
Undocumented declaration.
104+
Slug field for BasePost.
121105

122106
### statusField
123107

124108
Status field for BasePost.
125109

126110
### templateField
127111

128-
Undocumented declaration.
112+
Template field for BasePost.
129113

130114
### titleField
131115

132-
Undocumented declaration.
116+
Title field for BasePost.
133117

134118
### trashPost
135119

136-
Undocumented declaration.
120+
Trash action for PostWithPermissions.
137121

138122
### viewPost
139123

140-
Undocumented declaration.
124+
View post action for BasePost.
141125

142126
### viewPostRevisions
143127

144-
Undocumented declaration.
128+
View post revisions action for Post.
145129

146130
<!-- END TOKEN(Autogenerated API docs) -->
147131

packages/fields/src/actions/delete-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -203,4 +203,7 @@ const deletePostAction: Action< Template | TemplatePart | Pattern > = {
203203
},
204204
};
205205

206+
/**
207+
* Delete action for Templates, Patterns and Template Parts.
208+
*/
206209
export default deletePostAction;

packages/fields/src/actions/duplicate-pattern.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,7 @@ const duplicatePattern: Action< Pattern > = {
3737
},
3838
};
3939

40+
/**
41+
* Duplicate action for Pattern.
42+
*/
4043
export default duplicatePattern;

packages/fields/src/actions/duplicate-post.native.tsx

-3
This file was deleted.

packages/fields/src/actions/duplicate-post.tsx

+6-3
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ const duplicatePost: Action< BasePost > = {
3737
const [ item, setItem ] = useState< BasePost >( {
3838
...items[ 0 ],
3939
title: sprintf(
40-
/* translators: %s: Existing template title */
41-
_x( '%s (Copy)', 'template' ),
40+
/* translators: %s: Existing post title */
41+
_x( '%s (Copy)', 'post' ),
4242
getItemTitle( items[ 0 ] )
4343
),
4444
} );
@@ -104,7 +104,7 @@ const duplicatePost: Action< BasePost > = {
104104

105105
createSuccessNotice(
106106
sprintf(
107-
// translators: %s: Title of the created post or template, e.g: "Hello world".
107+
// translators: %s: Title of the created post, e.g: "Hello world".
108108
__( '"%s" successfully created.' ),
109109
decodeEntities( newItem.title?.rendered || item.title )
110110
),
@@ -171,4 +171,7 @@ const duplicatePost: Action< BasePost > = {
171171
},
172172
};
173173

174+
/**
175+
* Duplicate action for BasePost.
176+
*/
174177
export default duplicatePost;

packages/fields/src/actions/duplicate-template-part.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -68,5 +68,7 @@ const duplicateTemplatePart: Action< TemplatePart > = {
6868
);
6969
},
7070
};
71-
71+
/**
72+
* Duplicate action for TemplatePart.
73+
*/
7274
export default duplicateTemplatePart;

packages/fields/src/actions/export-pattern.native.tsx

-3
This file was deleted.

packages/fields/src/actions/export-pattern.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,7 @@ const exportPattern: Action< Pattern > = {
7373
},
7474
};
7575

76+
/**
77+
* Export action as JSON for Pattern.
78+
*/
7679
export default exportPattern;

packages/fields/src/actions/index.ts

-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
export { default as viewPost } from './view-post';
22
export { default as reorderPage } from './reorder-page';
3-
export { default as reorderPageNative } from './reorder-page.native';
43
export { default as duplicatePost } from './duplicate-post';
5-
export { default as duplicatePostNative } from './duplicate-post.native';
64
export { default as renamePost } from './rename-post';
75
export { default as resetPost } from './reset-post';
86
export { default as duplicatePattern } from './duplicate-pattern';
97
export { default as exportPattern } from './export-pattern';
10-
export { default as exportPatternNative } from './export-pattern.native';
118
export { default as viewPostRevisions } from './view-post-revisions';
129
export { default as permanentlyDeletePost } from './permanently-delete-post';
1310
export { default as restorePost } from './restore-post';

packages/fields/src/actions/permanently-delete-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -115,4 +115,7 @@ const permanentlyDeletePost: Action< PostWithPermissions > = {
115115
},
116116
};
117117

118+
/**
119+
* Delete action for PostWithPermissions.
120+
*/
118121
export default permanentlyDeletePost;

packages/fields/src/actions/rename-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -139,4 +139,7 @@ const renamePost: Action< PostWithPermissions > = {
139139
},
140140
};
141141

142+
/**
143+
* Rename action for PostWithPermissions.
144+
*/
142145
export default renamePost;

packages/fields/src/actions/reorder-page.native.tsx

-3
This file was deleted.

packages/fields/src/actions/reorder-page.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,7 @@ const reorderPage: Action< BasePost > = {
122122
RenderModal: ReorderModal,
123123
};
124124

125+
/**
126+
* Reorder action for BasePost.
127+
*/
125128
export default reorderPage;

packages/fields/src/actions/reset-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -292,4 +292,7 @@ const resetPostAction: Action< Template | TemplatePart > = {
292292
},
293293
};
294294

295+
/**
296+
* Reset action for Template and TemplatePart.
297+
*/
295298
export default resetPostAction;

packages/fields/src/actions/restore-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,7 @@ const restorePost: Action< PostWithPermissions > = {
131131
},
132132
};
133133

134+
/**
135+
* Restore action for PostWithPermissions.
136+
*/
134137
export default restorePost;

packages/fields/src/actions/trash-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -195,4 +195,7 @@ const trashPost: Action< PostWithPermissions > = {
195195
},
196196
};
197197

198+
/**
199+
* Trash action for PostWithPermissions.
200+
*/
198201
export default trashPost;

packages/fields/src/actions/view-post-revisions.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,7 @@ const viewPostRevisions: Action< Post > = {
4444
},
4545
};
4646

47+
/**
48+
* View post revisions action for Post.
49+
*/
4750
export default viewPostRevisions;

packages/fields/src/actions/view-post.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,7 @@ const viewPost: Action< BasePost > = {
2727
},
2828
};
2929

30+
/**
31+
* View post action for BasePost.
32+
*/
3033
export default viewPost;

packages/fields/src/fields/featured-image/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,7 @@ const featuredImageField: Field< BasePost > = {
2020
enableSorting: false,
2121
};
2222

23+
/**
24+
* Featured Image field for BasePost.
25+
*/
2326
export default featuredImageField;

packages/fields/src/fields/order/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,7 @@ const orderField: Field< BasePost > = {
1616
description: __( 'Determines the order of pages.' ),
1717
};
1818

19+
/**
20+
* Order field for BasePost.
21+
*/
1922
export default orderField;

packages/fields/src/fields/parent/index.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,6 @@ const parentField: Field< BasePost > = {
2121
};
2222

2323
/**
24-
* This field is used to display the post parent.
24+
* Parent field for BasePost.
2525
*/
2626
export default parentField;

packages/fields/src/fields/password/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,6 @@ const passwordField: Field< BasePost > = {
1919
};
2020

2121
/**
22-
* This field is used to display the post password.
22+
* Password field for BasePost.
2323
*/
2424
export default passwordField;

packages/fields/src/fields/slug/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,7 @@ const slugField: Field< BasePost > = {
1919
render: SlugView,
2020
};
2121

22+
/**
23+
* Slug field for BasePost.
24+
*/
2225
export default slugField;

packages/fields/src/fields/template/index.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ const templateField: Field< BasePost > = {
1414
id: 'template',
1515
type: 'text',
1616
label: __( 'Template' ),
17-
getValue: ( { item } ) => item.template,
1817
Edit: TemplateEdit,
1918
enableSorting: false,
2019
};
2120

21+
/**
22+
* Template field for BasePost.
23+
*/
2224
export default templateField;

packages/fields/src/fields/title/index.ts

+3
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,7 @@ const titleField: Field< BasePost > = {
2121
enableHiding: false,
2222
};
2323

24+
/**
25+
* Title field for BasePost.
26+
*/
2427
export default titleField;

packages/fields/src/index.native.ts

-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +0,0 @@
1-
export * from './actions/duplicate-post.native';
2-
export * from './actions/reorder-page.native';

0 commit comments

Comments
 (0)