@wordpress/editor 13.4.0 → 13.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/build/components/document-outline/index.js +7 -1
- package/build/components/document-outline/index.js.map +1 -1
- package/build/components/editor-help/index.native.js +13 -10
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/media-categories/index.js +1 -1
- package/build/components/media-categories/index.js.map +1 -1
- package/build/components/page-attributes/check.js +6 -10
- package/build/components/page-attributes/check.js.map +1 -1
- package/build/components/page-attributes/parent.js +9 -6
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/check.js +3 -7
- package/build/components/post-author/check.js.map +1 -1
- package/build/components/post-featured-image/index.js +7 -12
- package/build/components/post-featured-image/index.js.map +1 -1
- package/build/components/post-locked-modal/index.js +1 -7
- package/build/components/post-locked-modal/index.js.map +1 -1
- package/build/components/post-pending-status/check.js +3 -7
- package/build/components/post-pending-status/check.js.map +1 -1
- package/build/components/post-preview-button/index.js +3 -3
- package/build/components/post-preview-button/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +4 -4
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-button/label.js +3 -7
- package/build/components/post-publish-button/label.js.map +1 -1
- package/build/components/post-publish-panel/index.js +4 -8
- package/build/components/post-publish-panel/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +3 -7
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-publish-panel/postpublish.js +5 -9
- package/build/components/post-publish-panel/postpublish.js.map +1 -1
- package/build/components/post-publish-panel/prepublish.js +3 -7
- package/build/components/post-publish-panel/prepublish.js.map +1 -1
- package/build/components/post-schedule/check.js +3 -7
- package/build/components/post-schedule/check.js.map +1 -1
- package/build/components/post-sticky/check.js +3 -7
- package/build/components/post-sticky/check.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +12 -7
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +18 -12
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/most-used-terms.js +1 -8
- package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build/components/post-visibility/check.js +3 -7
- package/build/components/post-visibility/check.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +1 -1
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/theme-support-check/index.js +3 -7
- package/build/components/theme-support-check/index.js.map +1 -1
- package/build/store/utils/notice-builder.js +4 -8
- package/build/store/utils/notice-builder.js.map +1 -1
- package/build-module/components/document-outline/index.js +8 -2
- package/build-module/components/document-outline/index.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +13 -9
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/media-categories/index.js +1 -1
- package/build-module/components/media-categories/index.js.map +1 -1
- package/build-module/components/page-attributes/check.js +6 -9
- package/build-module/components/page-attributes/check.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +9 -5
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/check.js +3 -6
- package/build-module/components/post-author/check.js.map +1 -1
- package/build-module/components/post-featured-image/index.js +7 -11
- package/build-module/components/post-featured-image/index.js.map +1 -1
- package/build-module/components/post-locked-modal/index.js +1 -6
- package/build-module/components/post-locked-modal/index.js.map +1 -1
- package/build-module/components/post-pending-status/check.js +3 -6
- package/build-module/components/post-pending-status/check.js.map +1 -1
- package/build-module/components/post-preview-button/index.js +3 -2
- package/build-module/components/post-preview-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +4 -3
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-button/label.js +3 -6
- package/build-module/components/post-publish-button/label.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +4 -7
- package/build-module/components/post-publish-panel/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +3 -6
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/postpublish.js +5 -8
- package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
- package/build-module/components/post-publish-panel/prepublish.js +3 -6
- package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
- package/build-module/components/post-schedule/check.js +3 -6
- package/build-module/components/post-schedule/check.js.map +1 -1
- package/build-module/components/post-sticky/check.js +3 -6
- package/build-module/components/post-sticky/check.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +12 -6
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +18 -11
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/most-used-terms.js +1 -7
- package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
- package/build-module/components/post-visibility/check.js +3 -6
- package/build-module/components/post-visibility/check.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +1 -1
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/theme-support-check/index.js +3 -6
- package/build-module/components/theme-support-check/index.js.map +1 -1
- package/build-module/store/utils/notice-builder.js +4 -7
- package/build-module/store/utils/notice-builder.js.map +1 -1
- package/build-style/style-rtl.css +1 -1
- package/build-style/style.css +1 -1
- package/package.json +30 -30
- package/src/components/autosave-monitor/test/index.js +4 -4
- package/src/components/document-outline/index.js +6 -3
- package/src/components/editor-help/index.native.js +21 -14
- package/src/components/media-categories/index.js +1 -1
- package/src/components/page-attributes/check.js +3 -12
- package/src/components/page-attributes/parent.js +41 -41
- package/src/components/post-author/check.js +2 -10
- package/src/components/post-featured-image/index.js +5 -10
- package/src/components/post-locked-modal/index.js +1 -6
- package/src/components/post-pending-status/check.js +2 -10
- package/src/components/post-preview-button/index.js +1 -2
- package/src/components/post-publish-button/index.js +3 -7
- package/src/components/post-publish-button/label.js +2 -10
- package/src/components/post-publish-panel/index.js +3 -11
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -10
- package/src/components/post-publish-panel/postpublish.js +3 -8
- package/src/components/post-publish-panel/prepublish.js +2 -10
- package/src/components/post-publish-panel/style.scss +1 -1
- package/src/components/post-schedule/check.js +2 -10
- package/src/components/post-sticky/check.js +1 -10
- package/src/components/post-taxonomies/flat-term-selector.js +14 -32
- package/src/components/post-taxonomies/hierarchical-term-selector.js +15 -37
- package/src/components/post-taxonomies/most-used-terms.js +1 -7
- package/src/components/post-text-editor/test/index.js +0 -2
- package/src/components/post-visibility/check.js +2 -10
- package/src/components/provider/use-block-editor-settings.js +1 -0
- package/src/components/theme-support-check/index.js +1 -6
- package/src/store/test/actions.js +0 -2
- package/src/store/utils/notice-builder.js +2 -7
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { kebabCase } from 'lodash';
|
|
5
4
|
import { SafeAreaView, ScrollView, StyleSheet, View } from 'react-native';
|
|
6
5
|
import { TransitionPresets } from '@react-navigation/stack';
|
|
7
6
|
|
|
@@ -40,18 +39,31 @@ import HelpSectionTitle from './help-section-title';
|
|
|
40
39
|
const HELP_TOPICS = [
|
|
41
40
|
{
|
|
42
41
|
label: __( 'What is a block?' ),
|
|
42
|
+
slug: 'what-is-a-block',
|
|
43
43
|
icon: helpFilled,
|
|
44
44
|
view: <IntroToBlocks />,
|
|
45
45
|
},
|
|
46
46
|
{
|
|
47
47
|
label: __( 'Add blocks' ),
|
|
48
|
+
slug: 'add-blocks',
|
|
48
49
|
icon: plusCircleFilled,
|
|
49
50
|
view: <AddBlocks />,
|
|
50
51
|
},
|
|
51
|
-
{
|
|
52
|
-
|
|
52
|
+
{
|
|
53
|
+
label: __( 'Move blocks' ),
|
|
54
|
+
slug: 'move-blocks',
|
|
55
|
+
icon: moveBlocksIcon,
|
|
56
|
+
view: <MoveBlocks />,
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
label: __( 'Remove blocks' ),
|
|
60
|
+
slug: 'remove-blocks',
|
|
61
|
+
icon: trash,
|
|
62
|
+
view: <RemoveBlocks />,
|
|
63
|
+
},
|
|
53
64
|
{
|
|
54
65
|
label: __( 'Customize blocks' ),
|
|
66
|
+
slug: 'customize-blocks',
|
|
55
67
|
icon: cog,
|
|
56
68
|
view: <CustomizeBlocks />,
|
|
57
69
|
},
|
|
@@ -141,24 +153,20 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
|
|
|
141
153
|
{ /* Print out help topics. */ }
|
|
142
154
|
{ HELP_TOPICS.map(
|
|
143
155
|
(
|
|
144
|
-
{ label, icon },
|
|
156
|
+
{ label, icon, slug },
|
|
145
157
|
index
|
|
146
158
|
) => {
|
|
147
|
-
const labelSlug =
|
|
148
|
-
kebabCase( label );
|
|
149
159
|
const isLastItem =
|
|
150
160
|
index ===
|
|
151
161
|
HELP_TOPICS.length -
|
|
152
162
|
1;
|
|
153
163
|
return (
|
|
154
164
|
<HelpTopicRow
|
|
155
|
-
key={
|
|
156
|
-
labelSlug
|
|
157
|
-
}
|
|
165
|
+
key={ slug }
|
|
158
166
|
label={ label }
|
|
159
167
|
icon={ icon }
|
|
160
168
|
screenName={
|
|
161
|
-
|
|
169
|
+
slug
|
|
162
170
|
}
|
|
163
171
|
isLastItem={
|
|
164
172
|
isLastItem
|
|
@@ -177,12 +185,11 @@ function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
|
|
|
177
185
|
</View>
|
|
178
186
|
</BottomSheet.NavigationScreen>
|
|
179
187
|
{ /* Print out help detail screens. */ }
|
|
180
|
-
{ HELP_TOPICS.map( ( { view, label } ) => {
|
|
181
|
-
const labelSlug = kebabCase( label );
|
|
188
|
+
{ HELP_TOPICS.map( ( { view, label, slug } ) => {
|
|
182
189
|
return (
|
|
183
190
|
<HelpDetailNavigationScreen
|
|
184
|
-
key={
|
|
185
|
-
name={
|
|
191
|
+
key={ slug }
|
|
192
|
+
name={ slug }
|
|
186
193
|
content={ view }
|
|
187
194
|
label={ label }
|
|
188
195
|
options={ {
|
|
@@ -131,7 +131,7 @@ const getOpenverseCaption = ( item ) => {
|
|
|
131
131
|
)
|
|
132
132
|
: sprintf(
|
|
133
133
|
// translators: %1s: Link attributes for a given Openverse media work; %2s: Works's licence e.g: "CC0 1.0".
|
|
134
|
-
_x( '<a %1$s>Work</a>/ %
|
|
134
|
+
_x( '<a %1$s>Work</a>/ %2$s', 'caption' ),
|
|
135
135
|
getExternalLinkAttributes( foreignLandingUrl ),
|
|
136
136
|
licenseUrl
|
|
137
137
|
? getExternalLink(
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -15,17 +10,13 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
15
10
|
import { store as editorStore } from '../../store';
|
|
16
11
|
|
|
17
12
|
export function PageAttributesCheck( { children } ) {
|
|
18
|
-
const
|
|
13
|
+
const supportsPageAttributes = useSelect( ( select ) => {
|
|
19
14
|
const { getEditedPostAttribute } = select( editorStore );
|
|
20
15
|
const { getPostType } = select( coreStore );
|
|
16
|
+
const postType = getPostType( getEditedPostAttribute( 'type' ) );
|
|
21
17
|
|
|
22
|
-
return
|
|
18
|
+
return !! postType?.supports?.[ 'page-attributes' ];
|
|
23
19
|
}, [] );
|
|
24
|
-
const supportsPageAttributes = get(
|
|
25
|
-
postType,
|
|
26
|
-
[ 'supports', 'page-attributes' ],
|
|
27
|
-
false
|
|
28
|
-
);
|
|
29
20
|
|
|
30
21
|
// Only render fields if post type supports page attributes or available templates exist.
|
|
31
22
|
if ( ! supportsPageAttributes ) {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import removeAccents from 'remove-accents';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -44,47 +43,48 @@ export const getItemPriority = ( name, searchValue ) => {
|
|
|
44
43
|
export function PageAttributesParent() {
|
|
45
44
|
const { editPost } = useDispatch( editorStore );
|
|
46
45
|
const [ fieldValue, setFieldValue ] = useState( false );
|
|
47
|
-
const { parentPost, parentPostId, items, postType } =
|
|
48
|
-
(
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
:
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
:
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
46
|
+
const { isHierarchical, parentPost, parentPostId, items, postType } =
|
|
47
|
+
useSelect(
|
|
48
|
+
( select ) => {
|
|
49
|
+
const { getPostType, getEntityRecords, getEntityRecord } =
|
|
50
|
+
select( coreStore );
|
|
51
|
+
const { getCurrentPostId, getEditedPostAttribute } =
|
|
52
|
+
select( editorStore );
|
|
53
|
+
const postTypeSlug = getEditedPostAttribute( 'type' );
|
|
54
|
+
const pageId = getEditedPostAttribute( 'parent' );
|
|
55
|
+
const pType = getPostType( postTypeSlug );
|
|
56
|
+
const postId = getCurrentPostId();
|
|
57
|
+
const postIsHierarchical = pType?.hierarchical ?? false;
|
|
58
|
+
const query = {
|
|
59
|
+
per_page: 100,
|
|
60
|
+
exclude: postId,
|
|
61
|
+
parent_exclude: postId,
|
|
62
|
+
orderby: 'menu_order',
|
|
63
|
+
order: 'asc',
|
|
64
|
+
_fields: 'id,title,parent',
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
// Perform a search when the field is changed.
|
|
68
|
+
if ( !! fieldValue ) {
|
|
69
|
+
query.search = fieldValue;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
isHierarchical: postIsHierarchical,
|
|
74
|
+
parentPostId: pageId,
|
|
75
|
+
parentPost: pageId
|
|
76
|
+
? getEntityRecord( 'postType', postTypeSlug, pageId )
|
|
77
|
+
: null,
|
|
78
|
+
items: postIsHierarchical
|
|
79
|
+
? getEntityRecords( 'postType', postTypeSlug, query )
|
|
80
|
+
: [],
|
|
81
|
+
postType: pType,
|
|
82
|
+
};
|
|
83
|
+
},
|
|
84
|
+
[ fieldValue ]
|
|
85
|
+
);
|
|
85
86
|
|
|
86
|
-
const
|
|
87
|
-
const parentPageLabel = get( postType, [ 'labels', 'parent_item_colon' ] );
|
|
87
|
+
const parentPageLabel = postType?.labels?.parent_item_colon;
|
|
88
88
|
const pageItems = items || [];
|
|
89
89
|
|
|
90
90
|
const parentOptions = useMemo( () => {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -21,11 +16,8 @@ export default function PostAuthorCheck( { children } ) {
|
|
|
21
16
|
const post = select( editorStore ).getCurrentPost();
|
|
22
17
|
const authors = select( coreStore ).getUsers( AUTHORS_QUERY );
|
|
23
18
|
return {
|
|
24
|
-
hasAssignAuthorAction:
|
|
25
|
-
post,
|
|
26
|
-
[ '_links', 'wp:action-assign-author' ],
|
|
27
|
-
false
|
|
28
|
-
),
|
|
19
|
+
hasAssignAuthorAction:
|
|
20
|
+
post._links?.[ 'wp:action-assign-author' ] ?? false,
|
|
29
21
|
hasAuthors: authors?.length >= 1,
|
|
30
22
|
};
|
|
31
23
|
}, [] );
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -105,7 +100,6 @@ function PostFeaturedImage( {
|
|
|
105
100
|
const mediaUpload = useSelect( ( select ) => {
|
|
106
101
|
return select( blockEditorStore ).getSettings().mediaUpload;
|
|
107
102
|
}, [] );
|
|
108
|
-
const postLabel = get( postType, [ 'labels' ], {} );
|
|
109
103
|
const { mediaWidth, mediaHeight, mediaSourceUrl } = getMediaDetails(
|
|
110
104
|
media,
|
|
111
105
|
currentPostId
|
|
@@ -159,7 +153,7 @@ function PostFeaturedImage( {
|
|
|
159
153
|
<MediaUploadCheck fallback={ instructions }>
|
|
160
154
|
<MediaUpload
|
|
161
155
|
title={
|
|
162
|
-
|
|
156
|
+
postType?.labels?.featured_image ||
|
|
163
157
|
DEFAULT_FEATURE_IMAGE_LABEL
|
|
164
158
|
}
|
|
165
159
|
onSelect={ onUpdateImage }
|
|
@@ -201,7 +195,8 @@ function PostFeaturedImage( {
|
|
|
201
195
|
{ isLoading && <Spinner /> }
|
|
202
196
|
{ ! featuredImageId &&
|
|
203
197
|
! isLoading &&
|
|
204
|
-
(
|
|
198
|
+
( postType?.labels
|
|
199
|
+
?.set_featured_image ||
|
|
205
200
|
DEFAULT_SET_FEATURE_IMAGE_LABEL ) }
|
|
206
201
|
</Button>
|
|
207
202
|
<DropZone onFilesDrop={ onDropFiles } />
|
|
@@ -215,7 +210,7 @@ function PostFeaturedImage( {
|
|
|
215
210
|
{ media && (
|
|
216
211
|
<MediaUpload
|
|
217
212
|
title={
|
|
218
|
-
|
|
213
|
+
postType?.labels?.featured_image ||
|
|
219
214
|
DEFAULT_FEATURE_IMAGE_LABEL
|
|
220
215
|
}
|
|
221
216
|
onSelect={ onUpdateImage }
|
|
@@ -237,7 +232,7 @@ function PostFeaturedImage( {
|
|
|
237
232
|
variant="link"
|
|
238
233
|
isDestructive
|
|
239
234
|
>
|
|
240
|
-
{
|
|
235
|
+
{ postType?.labels?.remove_featured_image ||
|
|
241
236
|
DEFAULT_REMOVE_FEATURE_IMAGE_LABEL }
|
|
242
237
|
</Button>
|
|
243
238
|
</MediaUploadCheck>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -164,7 +159,7 @@ export default function PostLockedModal() {
|
|
|
164
159
|
_wpnonce: postLockUtils.nonce,
|
|
165
160
|
} );
|
|
166
161
|
const allPostsUrl = addQueryArgs( 'edit.php', {
|
|
167
|
-
post_type:
|
|
162
|
+
post_type: postType?.slug,
|
|
168
163
|
} );
|
|
169
164
|
const allPostsLabel = __( 'Exit editor' );
|
|
170
165
|
return (
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -31,11 +26,8 @@ export default compose(
|
|
|
31
26
|
const { isCurrentPostPublished, getCurrentPostType, getCurrentPost } =
|
|
32
27
|
select( editorStore );
|
|
33
28
|
return {
|
|
34
|
-
hasPublishAction:
|
|
35
|
-
getCurrentPost(),
|
|
36
|
-
[ '_links', 'wp:action-publish' ],
|
|
37
|
-
false
|
|
38
|
-
),
|
|
29
|
+
hasPublishAction:
|
|
30
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
39
31
|
isPublished: isCurrentPostPublished(),
|
|
40
32
|
postType: getCurrentPostType(),
|
|
41
33
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -256,7 +255,7 @@ export default compose( [
|
|
|
256
255
|
forcePreviewLink !== undefined ? forcePreviewLink : previewLink,
|
|
257
256
|
isSaveable: isEditedPostSaveable(),
|
|
258
257
|
isAutosaveable: forceIsAutosaveable || isEditedPostAutosaveable(),
|
|
259
|
-
isViewable:
|
|
258
|
+
isViewable: postType?.viewable ?? false,
|
|
260
259
|
isDraft:
|
|
261
260
|
[ 'draft', 'auto-draft' ].indexOf(
|
|
262
261
|
getEditedPostAttribute( 'status' )
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import classnames from 'classnames';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -169,7 +168,7 @@ export class PostPublishButton extends Component {
|
|
|
169
168
|
const buttonProps = {
|
|
170
169
|
'aria-disabled': isButtonDisabled,
|
|
171
170
|
className: 'editor-post-publish-button',
|
|
172
|
-
isBusy: ! isAutoSaving && isSaving
|
|
171
|
+
isBusy: ! isAutoSaving && isSaving,
|
|
173
172
|
variant: 'primary',
|
|
174
173
|
onClick: this.createOnClick( onClickButton ),
|
|
175
174
|
};
|
|
@@ -242,11 +241,8 @@ export default compose( [
|
|
|
242
241
|
isPostSavingLocked: isPostSavingLocked(),
|
|
243
242
|
isPublishable: isEditedPostPublishable(),
|
|
244
243
|
isPublished: isCurrentPostPublished(),
|
|
245
|
-
hasPublishAction:
|
|
246
|
-
getCurrentPost(),
|
|
247
|
-
[ '_links', 'wp:action-publish' ],
|
|
248
|
-
false
|
|
249
|
-
),
|
|
244
|
+
hasPublishAction:
|
|
245
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
250
246
|
postType: getCurrentPostType(),
|
|
251
247
|
postId: getCurrentPostId(),
|
|
252
248
|
hasNonPostEntityChanges: hasNonPostEntityChanges(),
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -64,11 +59,8 @@ export default compose( [
|
|
|
64
59
|
isBeingScheduled: isEditedPostBeingScheduled(),
|
|
65
60
|
isSaving: forceIsSaving || isSavingPost(),
|
|
66
61
|
isPublishing: isPublishingPost(),
|
|
67
|
-
hasPublishAction:
|
|
68
|
-
getCurrentPost(),
|
|
69
|
-
[ '_links', 'wp:action-publish' ],
|
|
70
|
-
false
|
|
71
|
-
),
|
|
62
|
+
hasPublishAction:
|
|
63
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
72
64
|
postType: getCurrentPostType(),
|
|
73
65
|
isAutosaving: isAutosavingPost(),
|
|
74
66
|
};
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -153,12 +148,9 @@ export default compose( [
|
|
|
153
148
|
const postType = getPostType( getEditedPostAttribute( 'type' ) );
|
|
154
149
|
|
|
155
150
|
return {
|
|
156
|
-
hasPublishAction:
|
|
157
|
-
getCurrentPost(),
|
|
158
|
-
|
|
159
|
-
false
|
|
160
|
-
),
|
|
161
|
-
isPostTypeViewable: get( postType, [ 'viewable' ], false ),
|
|
151
|
+
hasPublishAction:
|
|
152
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
153
|
+
isPostTypeViewable: postType?.viewable,
|
|
162
154
|
isBeingScheduled: isEditedPostBeingScheduled(),
|
|
163
155
|
isDirty: isEditedPostDirty(),
|
|
164
156
|
isPublished: isCurrentPostPublished(),
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -41,11 +36,8 @@ export default function PostFormatPanel() {
|
|
|
41
36
|
const { currentPostFormat, suggestion } = useSelect( ( select ) => {
|
|
42
37
|
const { getEditedPostAttribute, getSuggestedPostFormat } =
|
|
43
38
|
select( editorStore );
|
|
44
|
-
const supportedFormats =
|
|
45
|
-
select( coreStore ).getThemeSupports()
|
|
46
|
-
[ 'formats' ],
|
|
47
|
-
[]
|
|
48
|
-
);
|
|
39
|
+
const supportedFormats =
|
|
40
|
+
select( coreStore ).getThemeSupports().formats ?? [];
|
|
49
41
|
return {
|
|
50
42
|
currentPostFormat: getEditedPostAttribute( 'format' ),
|
|
51
43
|
suggestion: getSuggestion(
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -90,9 +85,9 @@ class PostPublishPanelPostpublish extends Component {
|
|
|
90
85
|
|
|
91
86
|
render() {
|
|
92
87
|
const { children, isScheduled, post, postType } = this.props;
|
|
93
|
-
const postLabel =
|
|
94
|
-
const viewPostLabel =
|
|
95
|
-
const addNewPostLabel =
|
|
88
|
+
const postLabel = postType?.labels?.singular_name;
|
|
89
|
+
const viewPostLabel = postType?.labels?.view_item;
|
|
90
|
+
const addNewPostLabel = postType?.labels?.add_new_item;
|
|
96
91
|
const link =
|
|
97
92
|
post.status === 'future' ? getFuturePostUrl( post ) : post.link;
|
|
98
93
|
const addLink = addQueryArgs( 'post-new.php', {
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -42,11 +37,8 @@ function PostPublishPanelPrepublish( { children } ) {
|
|
|
42
37
|
getEntityRecord( 'root', '__unstableBase', undefined ) || {};
|
|
43
38
|
|
|
44
39
|
return {
|
|
45
|
-
hasPublishAction:
|
|
46
|
-
getCurrentPost(),
|
|
47
|
-
[ '_links', 'wp:action-publish' ],
|
|
48
|
-
false
|
|
49
|
-
),
|
|
40
|
+
hasPublishAction:
|
|
41
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
50
42
|
isBeingScheduled: isEditedPostBeingScheduled(),
|
|
51
43
|
isRequestingSiteIcon: isResolving( 'getEntityRecord', [
|
|
52
44
|
'root',
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,11 +21,8 @@ export default compose( [
|
|
|
26
21
|
withSelect( ( select ) => {
|
|
27
22
|
const { getCurrentPost, getCurrentPostType } = select( editorStore );
|
|
28
23
|
return {
|
|
29
|
-
hasPublishAction:
|
|
30
|
-
getCurrentPost(),
|
|
31
|
-
[ '_links', 'wp:action-publish' ],
|
|
32
|
-
false
|
|
33
|
-
),
|
|
24
|
+
hasPublishAction:
|
|
25
|
+
getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
|
|
34
26
|
postType: getCurrentPostType(),
|
|
35
27
|
};
|
|
36
28
|
} ),
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -26,11 +21,7 @@ export default compose( [
|
|
|
26
21
|
withSelect( ( select ) => {
|
|
27
22
|
const post = select( editorStore ).getCurrentPost();
|
|
28
23
|
return {
|
|
29
|
-
hasStickyAction:
|
|
30
|
-
post,
|
|
31
|
-
[ '_links', 'wp:action-sticky' ],
|
|
32
|
-
false
|
|
33
|
-
),
|
|
24
|
+
hasStickyAction: post._links?.[ 'wp:action-sticky' ] ?? false,
|
|
34
25
|
postType: select( editorStore ).getCurrentPostType(),
|
|
35
26
|
};
|
|
36
27
|
} ),
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get } from 'lodash';
|
|
5
4
|
import escapeHtml from 'escape-html';
|
|
6
5
|
|
|
7
6
|
/**
|
|
@@ -106,24 +105,14 @@ export function FlatTermSelector( { slug } ) {
|
|
|
106
105
|
|
|
107
106
|
return {
|
|
108
107
|
hasCreateAction: _taxonomy
|
|
109
|
-
?
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
'_links',
|
|
113
|
-
'wp:action-create-' + _taxonomy.rest_base,
|
|
114
|
-
],
|
|
115
|
-
false
|
|
116
|
-
)
|
|
108
|
+
? post._links?.[
|
|
109
|
+
'wp:action-create-' + _taxonomy.rest_base
|
|
110
|
+
] ?? false
|
|
117
111
|
: false,
|
|
118
112
|
hasAssignAction: _taxonomy
|
|
119
|
-
?
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
'_links',
|
|
123
|
-
'wp:action-assign-' + _taxonomy.rest_base,
|
|
124
|
-
],
|
|
125
|
-
false
|
|
126
|
-
)
|
|
113
|
+
? post._links?.[
|
|
114
|
+
'wp:action-assign-' + _taxonomy.rest_base
|
|
115
|
+
] ?? false
|
|
127
116
|
: false,
|
|
128
117
|
taxonomy: _taxonomy,
|
|
129
118
|
termIds: _termIds,
|
|
@@ -239,30 +228,23 @@ export function FlatTermSelector( { slug } ) {
|
|
|
239
228
|
}
|
|
240
229
|
|
|
241
230
|
const newTermIds = [ ...termIds, newTerm.id ];
|
|
231
|
+
const defaultName = slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' );
|
|
242
232
|
const termAddedMessage = sprintf(
|
|
243
233
|
/* translators: %s: term name. */
|
|
244
234
|
_x( '%s added', 'term' ),
|
|
245
|
-
|
|
246
|
-
taxonomy,
|
|
247
|
-
[ 'labels', 'singular_name' ],
|
|
248
|
-
slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )
|
|
249
|
-
)
|
|
235
|
+
taxonomy?.labels?.singular_name ?? defaultName
|
|
250
236
|
);
|
|
251
237
|
|
|
252
238
|
speak( termAddedMessage, 'assertive' );
|
|
253
239
|
onUpdateTerms( newTermIds );
|
|
254
240
|
}
|
|
255
241
|
|
|
256
|
-
const newTermLabel =
|
|
257
|
-
taxonomy
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
taxonomy,
|
|
263
|
-
[ 'labels', 'singular_name' ],
|
|
264
|
-
slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' )
|
|
265
|
-
);
|
|
242
|
+
const newTermLabel =
|
|
243
|
+
taxonomy?.labels?.add_new_item ??
|
|
244
|
+
( slug === 'post_tag' ? __( 'Add new tag' ) : __( 'Add new Term' ) );
|
|
245
|
+
const singularName =
|
|
246
|
+
taxonomy?.labels?.singular_name ??
|
|
247
|
+
( slug === 'post_tag' ? __( 'Tag' ) : __( 'Term' ) );
|
|
266
248
|
const termAddedLabel = sprintf(
|
|
267
249
|
/* translators: %s: term name. */
|
|
268
250
|
_x( '%s added', 'term' ),
|