@wordpress/editor 12.21.0 → 13.1.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 +8 -0
- package/build/components/document-outline/check.js +1 -7
- package/build/components/document-outline/check.js.map +1 -1
- package/build/components/editor-help/index.native.js +10 -8
- package/build/components/editor-help/index.native.js.map +1 -1
- package/build/components/editor-notices/index.js +12 -12
- package/build/components/editor-notices/index.js.map +1 -1
- package/build/components/editor-snackbars/index.js +5 -8
- package/build/components/editor-snackbars/index.js.map +1 -1
- package/build/components/page-attributes/parent.js +2 -1
- package/build/components/page-attributes/parent.js.map +1 -1
- package/build/components/post-author/combobox.js +1 -0
- package/build/components/post-author/combobox.js.map +1 -1
- package/build/components/post-excerpt/index.js +1 -0
- package/build/components/post-excerpt/index.js.map +1 -1
- package/build/components/post-format/index.js +1 -7
- package/build/components/post-format/index.js.map +1 -1
- package/build/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
- package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build/components/post-taxonomies/flat-term-selector.js +2 -2
- package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js +1 -1
- package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build/components/post-taxonomies/index.js +2 -8
- package/build/components/post-taxonomies/index.js.map +1 -1
- package/build/components/post-title/index.native.js +2 -4
- package/build/components/post-title/index.native.js.map +1 -1
- package/build/components/post-url/index.js +6 -2
- package/build/components/post-url/index.js.map +1 -1
- package/build/components/provider/index.native.js +2 -1
- package/build/components/provider/index.native.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.js +10 -9
- package/build/components/provider/use-block-editor-settings.js.map +1 -1
- package/build/components/provider/use-block-editor-settings.native.js +3 -1
- package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-module/components/document-outline/check.js +1 -6
- package/build-module/components/document-outline/check.js.map +1 -1
- package/build-module/components/editor-help/index.native.js +11 -9
- package/build-module/components/editor-help/index.native.js.map +1 -1
- package/build-module/components/editor-notices/index.js +12 -11
- package/build-module/components/editor-notices/index.js.map +1 -1
- package/build-module/components/editor-snackbars/index.js +5 -7
- package/build-module/components/editor-snackbars/index.js.map +1 -1
- package/build-module/components/page-attributes/parent.js +3 -2
- package/build-module/components/page-attributes/parent.js.map +1 -1
- package/build-module/components/post-author/combobox.js +1 -0
- package/build-module/components/post-author/combobox.js.map +1 -1
- package/build-module/components/post-excerpt/index.js +1 -0
- package/build-module/components/post-excerpt/index.js.map +1 -1
- package/build-module/components/post-format/index.js +1 -6
- package/build-module/components/post-format/index.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-category-panel.js +10 -5
- package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
- package/build-module/components/post-taxonomies/flat-term-selector.js +3 -3
- package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
- package/build-module/components/post-taxonomies/index.js +2 -7
- package/build-module/components/post-taxonomies/index.js.map +1 -1
- package/build-module/components/post-title/index.native.js +2 -3
- package/build-module/components/post-title/index.native.js.map +1 -1
- package/build-module/components/post-url/index.js +6 -2
- package/build-module/components/post-url/index.js.map +1 -1
- package/build-module/components/provider/index.native.js +4 -2
- package/build-module/components/provider/index.native.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.js +10 -8
- package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
- package/build-module/components/provider/use-block-editor-settings.native.js +2 -1
- package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
- package/build-style/style-rtl.css +20 -6
- package/build-style/style.css +20 -6
- package/package.json +31 -31
- package/src/components/document-outline/check.js +1 -7
- package/src/components/editor-help/index.native.js +17 -26
- package/src/components/editor-notices/index.js +6 -13
- package/src/components/editor-snackbars/index.js +3 -8
- package/src/components/page-attributes/parent.js +3 -3
- package/src/components/page-attributes/test/order.js +2 -0
- package/src/components/post-author/combobox.js +1 -0
- package/src/components/post-excerpt/index.js +1 -0
- package/src/components/post-format/index.js +1 -7
- package/src/components/post-preview-button/test/index.js +2 -0
- package/src/components/post-publish-button/test/index.js +2 -0
- package/src/components/post-publish-panel/maybe-category-panel.js +9 -12
- package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
- package/src/components/post-saved-state/test/index.js +2 -0
- package/src/components/post-slug/test/index.js +3 -5
- package/src/components/post-taxonomies/flat-term-selector.js +3 -3
- package/src/components/post-taxonomies/hierarchical-term-selector.js +2 -2
- package/src/components/post-taxonomies/index.js +2 -8
- package/src/components/post-taxonomies/test/index.js +1 -1
- package/src/components/post-title/index.native.js +2 -3
- package/src/components/post-url/index.js +6 -2
- package/src/components/provider/index.native.js +2 -0
- package/src/components/provider/use-block-editor-settings.js +56 -50
- package/src/components/provider/use-block-editor-settings.native.js +3 -1
|
@@ -57,7 +57,7 @@ const HELP_TOPICS = [
|
|
|
57
57
|
},
|
|
58
58
|
];
|
|
59
59
|
|
|
60
|
-
function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
60
|
+
function EditorHelpTopics( { close, isVisible, onClose, showSupport } ) {
|
|
61
61
|
const { postType } = useSelect( ( select ) => ( {
|
|
62
62
|
postType: select( editorStore ).getEditedPostAttribute( 'type' ),
|
|
63
63
|
} ) );
|
|
@@ -67,6 +67,20 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
67
67
|
? __( 'How to edit your page' )
|
|
68
68
|
: __( 'How to edit your post' );
|
|
69
69
|
|
|
70
|
+
const supportSection = (
|
|
71
|
+
<>
|
|
72
|
+
<HelpSectionTitle>{ __( 'Get support' ) }</HelpSectionTitle>
|
|
73
|
+
<HelpGetSupportButton
|
|
74
|
+
title={ __( 'Contact support' ) }
|
|
75
|
+
onPress={ requestContactCustomerSupport }
|
|
76
|
+
/>
|
|
77
|
+
<HelpGetSupportButton
|
|
78
|
+
title={ __( 'More support options' ) }
|
|
79
|
+
onPress={ requestGotoCustomerSupportOptions }
|
|
80
|
+
/>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
70
84
|
return (
|
|
71
85
|
<BottomSheet
|
|
72
86
|
isVisible={ isVisible }
|
|
@@ -153,31 +167,8 @@ function EditorHelpTopics( { close, isVisible, onClose } ) {
|
|
|
153
167
|
);
|
|
154
168
|
}
|
|
155
169
|
) }
|
|
156
|
-
{
|
|
157
|
-
|
|
158
|
-
{ __( 'Get support' ) }
|
|
159
|
-
</HelpSectionTitle>
|
|
160
|
-
}
|
|
161
|
-
{
|
|
162
|
-
<HelpGetSupportButton
|
|
163
|
-
title={ __(
|
|
164
|
-
'Contact support'
|
|
165
|
-
) }
|
|
166
|
-
onPress={
|
|
167
|
-
requestContactCustomerSupport
|
|
168
|
-
}
|
|
169
|
-
/>
|
|
170
|
-
}
|
|
171
|
-
{
|
|
172
|
-
<HelpGetSupportButton
|
|
173
|
-
title={ __(
|
|
174
|
-
'More support options'
|
|
175
|
-
) }
|
|
176
|
-
onPress={
|
|
177
|
-
requestGotoCustomerSupportOptions
|
|
178
|
-
}
|
|
179
|
-
/>
|
|
180
|
-
}
|
|
170
|
+
{ showSupport &&
|
|
171
|
+
supportSection }
|
|
181
172
|
</PanelBody>
|
|
182
173
|
</ScrollView>
|
|
183
174
|
);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -17,14 +12,12 @@ import { store as noticesStore } from '@wordpress/notices';
|
|
|
17
12
|
import TemplateValidationNotice from '../template-validation-notice';
|
|
18
13
|
|
|
19
14
|
export function EditorNotices( { notices, onRemove } ) {
|
|
20
|
-
const dismissibleNotices = filter(
|
|
21
|
-
isDismissible
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
type: 'default',
|
|
27
|
-
} );
|
|
15
|
+
const dismissibleNotices = notices.filter(
|
|
16
|
+
( { isDismissible, type } ) => isDismissible && type === 'default'
|
|
17
|
+
);
|
|
18
|
+
const nonDismissibleNotices = notices.filter(
|
|
19
|
+
( { isDismissible, type } ) => ! isDismissible && type === 'default'
|
|
20
|
+
);
|
|
28
21
|
|
|
29
22
|
return (
|
|
30
23
|
<>
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -16,9 +11,9 @@ export default function EditorSnackbars() {
|
|
|
16
11
|
[]
|
|
17
12
|
);
|
|
18
13
|
const { removeNotice } = useDispatch( noticesStore );
|
|
19
|
-
const snackbarNotices = filter(
|
|
20
|
-
type
|
|
21
|
-
|
|
14
|
+
const snackbarNotices = notices.filter(
|
|
15
|
+
( { type } ) => type === 'snackbar'
|
|
16
|
+
);
|
|
22
17
|
|
|
23
18
|
return (
|
|
24
19
|
<SnackbarList
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { get, unescape as unescapeString
|
|
4
|
+
import { get, unescape as unescapeString } from 'lodash';
|
|
5
5
|
import removeAccents from 'remove-accents';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -122,8 +122,7 @@ export function PageAttributesParent() {
|
|
|
122
122
|
const opts = getOptionsFromTree( tree );
|
|
123
123
|
|
|
124
124
|
// Ensure the current parent is in the options list.
|
|
125
|
-
const optsHasParent = find(
|
|
126
|
-
opts,
|
|
125
|
+
const optsHasParent = opts.find(
|
|
127
126
|
( item ) => item.value === parentPostId
|
|
128
127
|
);
|
|
129
128
|
if ( parentPost && ! optsHasParent ) {
|
|
@@ -158,6 +157,7 @@ export function PageAttributesParent() {
|
|
|
158
157
|
|
|
159
158
|
return (
|
|
160
159
|
<ComboboxControl
|
|
160
|
+
__nextHasNoMarginBottom
|
|
161
161
|
className="editor-page-attributes__parent"
|
|
162
162
|
label={ parentPageLabel }
|
|
163
163
|
value={ parentPostId }
|
|
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import { PageAttributesOrder } from '../order';
|
|
11
11
|
|
|
12
|
+
jest.useFakeTimers();
|
|
13
|
+
|
|
12
14
|
describe( 'PageAttributesOrder', () => {
|
|
13
15
|
/**
|
|
14
16
|
* When starting to type inside the spinbutton, select the current value
|
|
@@ -15,6 +15,7 @@ function PostExcerpt( { excerpt, onUpdateExcerpt } ) {
|
|
|
15
15
|
return (
|
|
16
16
|
<div className="editor-post-excerpt">
|
|
17
17
|
<TextareaControl
|
|
18
|
+
__nextHasNoMarginBottom
|
|
18
19
|
label={ __( 'Write an excerpt (optional)' ) }
|
|
19
20
|
className="editor-post-excerpt__textarea"
|
|
20
21
|
onChange={ ( value ) => onUpdateExcerpt( value ) }
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { find } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -69,8 +64,7 @@ export default function PostFormat() {
|
|
|
69
64
|
supportedFormats?.includes( format.id ) || postFormat === format.id
|
|
70
65
|
);
|
|
71
66
|
} );
|
|
72
|
-
const suggestion = find(
|
|
73
|
-
formats,
|
|
67
|
+
const suggestion = formats.find(
|
|
74
68
|
( format ) => format.id === suggestedFormat
|
|
75
69
|
);
|
|
76
70
|
|
|
@@ -9,6 +9,8 @@ import userEvent from '@testing-library/user-event';
|
|
|
9
9
|
*/
|
|
10
10
|
import { PostPublishButton } from '../';
|
|
11
11
|
|
|
12
|
+
jest.useFakeTimers();
|
|
13
|
+
|
|
12
14
|
describe( 'PostPublishButton', () => {
|
|
13
15
|
describe( 'aria-disabled', () => {
|
|
14
16
|
it( 'should be true if post is currently saving', () => {
|
|
@@ -16,17 +16,14 @@ import { store as editorStore } from '../../store';
|
|
|
16
16
|
function MaybeCategoryPanel() {
|
|
17
17
|
const hasNoCategory = useSelect( ( select ) => {
|
|
18
18
|
const postType = select( editorStore ).getCurrentPostType();
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
const defaultCategoryId =
|
|
22
|
-
'root',
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
'category',
|
|
28
|
-
defaultCategoryId
|
|
29
|
-
);
|
|
19
|
+
const { canUser, getEntityRecord, getTaxonomy } = select( coreStore );
|
|
20
|
+
const categoriesTaxonomy = getTaxonomy( 'category' );
|
|
21
|
+
const defaultCategoryId = canUser( 'read', 'settings' )
|
|
22
|
+
? getEntityRecord( 'root', 'site' )?.default_category
|
|
23
|
+
: undefined;
|
|
24
|
+
const defaultCategory = defaultCategoryId
|
|
25
|
+
? getEntityRecord( 'taxonomy', 'category', defaultCategoryId )
|
|
26
|
+
: undefined;
|
|
30
27
|
const postTypeSupportsCategories =
|
|
31
28
|
categoriesTaxonomy &&
|
|
32
29
|
categoriesTaxonomy.types.some( ( type ) => type === postType );
|
|
@@ -45,7 +42,7 @@ function MaybeCategoryPanel() {
|
|
|
45
42
|
postTypeSupportsCategories &&
|
|
46
43
|
( categories?.length === 0 ||
|
|
47
44
|
( categories?.length === 1 &&
|
|
48
|
-
defaultCategory
|
|
45
|
+
defaultCategory?.id === categories[ 0 ] ) )
|
|
49
46
|
);
|
|
50
47
|
}, [] );
|
|
51
48
|
const [ shouldShowPanel, setShouldShowPanel ] = useState( false );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -21,7 +21,7 @@ const getSuggestion = ( supportedFormats, suggestedPostFormat ) => {
|
|
|
21
21
|
const formats = POST_FORMATS.filter( ( format ) =>
|
|
22
22
|
supportedFormats?.includes( format.id )
|
|
23
23
|
);
|
|
24
|
-
return find(
|
|
24
|
+
return formats.find( ( format ) => format.id === suggestedPostFormat );
|
|
25
25
|
};
|
|
26
26
|
|
|
27
27
|
const PostFormatSuggestion = ( {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
+
import { act, render, screen } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -11,9 +11,7 @@ import { PostSlug } from '../';
|
|
|
11
11
|
|
|
12
12
|
describe( 'PostSlug', () => {
|
|
13
13
|
it( 'should update slug with sanitized input', async () => {
|
|
14
|
-
const user = userEvent.setup(
|
|
15
|
-
advanceTimers: jest.advanceTimersByTime,
|
|
16
|
-
} );
|
|
14
|
+
const user = userEvent.setup();
|
|
17
15
|
const onUpdateSlug = jest.fn();
|
|
18
16
|
|
|
19
17
|
render( <PostSlug postSlug="index" onUpdateSlug={ onUpdateSlug } /> );
|
|
@@ -21,7 +19,7 @@ describe( 'PostSlug', () => {
|
|
|
21
19
|
const input = screen.getByRole( 'textbox', { name: 'Slug' } );
|
|
22
20
|
await user.clear( input );
|
|
23
21
|
await user.type( input, 'Foo Bar-Baz 9!' );
|
|
24
|
-
input.blur();
|
|
22
|
+
act( () => input.blur() );
|
|
25
23
|
|
|
26
24
|
expect( onUpdateSlug ).toHaveBeenCalledWith( 'foo-bar-baz-9' );
|
|
27
25
|
} );
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get } from 'lodash';
|
|
5
5
|
import escapeHtml from 'escape-html';
|
|
6
6
|
|
|
7
7
|
/**
|
|
@@ -50,7 +50,7 @@ const isSameTermName = ( termA, termB ) =>
|
|
|
50
50
|
const termNamesToIds = ( names, terms ) => {
|
|
51
51
|
return names.map(
|
|
52
52
|
( termName ) =>
|
|
53
|
-
find(
|
|
53
|
+
terms.find( ( term ) => isSameTermName( term.name, termName ) ).id
|
|
54
54
|
);
|
|
55
55
|
};
|
|
56
56
|
|
|
@@ -203,7 +203,7 @@ export function FlatTermSelector( { slug } ) {
|
|
|
203
203
|
|
|
204
204
|
const newTermNames = uniqueTerms.filter(
|
|
205
205
|
( termName ) =>
|
|
206
|
-
! find(
|
|
206
|
+
! availableTerms.find( ( term ) =>
|
|
207
207
|
isSameTermName( term.name, termName )
|
|
208
208
|
)
|
|
209
209
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
|
-
import {
|
|
4
|
+
import { get, unescape as unescapeString } from 'lodash';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* WordPress dependencies
|
|
@@ -95,7 +95,7 @@ export function sortBySelected( termsTree, terms ) {
|
|
|
95
95
|
* @return {Object} Term object.
|
|
96
96
|
*/
|
|
97
97
|
export function findTerm( terms, parent, name ) {
|
|
98
|
-
return find(
|
|
98
|
+
return terms.find( ( term ) => {
|
|
99
99
|
return (
|
|
100
100
|
( ( ! term.parent && ! parent ) ||
|
|
101
101
|
parseInt( term.parent ) === parseInt( parent ) ) &&
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -25,11 +20,10 @@ export function PostTaxonomies( {
|
|
|
25
20
|
taxonomies,
|
|
26
21
|
taxonomyWrapper = identity,
|
|
27
22
|
} ) {
|
|
28
|
-
const availableTaxonomies =
|
|
23
|
+
const availableTaxonomies = ( taxonomies ?? [] ).filter( ( taxonomy ) =>
|
|
29
24
|
taxonomy.types.includes( postType )
|
|
30
25
|
);
|
|
31
|
-
const visibleTaxonomies = filter(
|
|
32
|
-
availableTaxonomies,
|
|
26
|
+
const visibleTaxonomies = availableTaxonomies.filter(
|
|
33
27
|
// In some circumstances .visibility can end up as undefined so optional chaining operator required.
|
|
34
28
|
// https://github.com/WordPress/gutenberg/issues/40326
|
|
35
29
|
( taxonomy ) => taxonomy.visibility?.show_ui
|
|
@@ -85,7 +85,7 @@ describe( 'PostTaxonomies', () => {
|
|
|
85
85
|
} );
|
|
86
86
|
|
|
87
87
|
it( 'should render no children if taxonomy data not available', () => {
|
|
88
|
-
const taxonomies =
|
|
88
|
+
const taxonomies = null;
|
|
89
89
|
|
|
90
90
|
const { container } = render(
|
|
91
91
|
<PostTaxonomies postType="page" taxonomies={ taxonomies } />
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
* External dependencies
|
|
3
3
|
*/
|
|
4
4
|
import { View } from 'react-native';
|
|
5
|
-
import { isEmpty } from 'lodash';
|
|
6
5
|
|
|
7
6
|
/**
|
|
8
7
|
* WordPress dependencies
|
|
@@ -80,7 +79,7 @@ class PostTitle extends Component {
|
|
|
80
79
|
|
|
81
80
|
getTitle( title, postType ) {
|
|
82
81
|
if ( 'page' === postType ) {
|
|
83
|
-
return
|
|
82
|
+
return ! title
|
|
84
83
|
? /* translators: accessibility text. empty page title. */
|
|
85
84
|
__( 'Page title. Empty' )
|
|
86
85
|
: sprintf(
|
|
@@ -90,7 +89,7 @@ class PostTitle extends Component {
|
|
|
90
89
|
);
|
|
91
90
|
}
|
|
92
91
|
|
|
93
|
-
return
|
|
92
|
+
return ! title
|
|
94
93
|
? /* translators: accessibility text. empty post title. */
|
|
95
94
|
__( 'Post title. Empty' )
|
|
96
95
|
: sprintf(
|
|
@@ -23,16 +23,20 @@ export default function PostURL( { onClose } ) {
|
|
|
23
23
|
permalinkPrefix,
|
|
24
24
|
permalinkSuffix,
|
|
25
25
|
} = useSelect( ( select ) => {
|
|
26
|
+
const post = select( editorStore ).getCurrentPost();
|
|
26
27
|
const postTypeSlug = select( editorStore ).getCurrentPostType();
|
|
27
28
|
const postType = select( coreStore ).getPostType( postTypeSlug );
|
|
28
29
|
const permalinkParts = select( editorStore ).getPermalinkParts();
|
|
30
|
+
const hasPublishAction = post?._links?.[ 'wp:action-publish' ] ?? false;
|
|
31
|
+
|
|
29
32
|
return {
|
|
30
|
-
isEditable:
|
|
33
|
+
isEditable:
|
|
34
|
+
select( editorStore ).isPermalinkEditable() && hasPublishAction,
|
|
31
35
|
postSlug: safeDecodeURIComponent(
|
|
32
36
|
select( editorStore ).getEditedPostSlug()
|
|
33
37
|
),
|
|
34
38
|
viewPostLabel: postType?.labels.view_item,
|
|
35
|
-
postLink:
|
|
39
|
+
postLink: post.link,
|
|
36
40
|
permalinkPrefix: permalinkParts?.prefix,
|
|
37
41
|
permalinkSuffix: permalinkParts?.suffix,
|
|
38
42
|
};
|
|
@@ -56,6 +56,7 @@ const postTypeEntities = [
|
|
|
56
56
|
import { EditorHelpTopics, store as editorStore } from '@wordpress/editor';
|
|
57
57
|
import { store as noticesStore } from '@wordpress/notices';
|
|
58
58
|
import { store as coreStore } from '@wordpress/core-data';
|
|
59
|
+
// eslint-disable-next-line no-restricted-imports
|
|
59
60
|
import { store as editPostStore } from '@wordpress/edit-post';
|
|
60
61
|
|
|
61
62
|
/**
|
|
@@ -337,6 +338,7 @@ class NativeEditorProvider extends Component {
|
|
|
337
338
|
isVisible={ this.state.isHelpVisible }
|
|
338
339
|
onClose={ () => this.setState( { isHelpVisible: false } ) }
|
|
339
340
|
close={ () => this.setState( { isHelpVisible: false } ) }
|
|
341
|
+
showSupport={ capabilities?.supportSection === true }
|
|
340
342
|
/>
|
|
341
343
|
</>
|
|
342
344
|
);
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { pick } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -12,6 +7,7 @@ import {
|
|
|
12
7
|
store as coreStore,
|
|
13
8
|
__experimentalFetchLinkSuggestions as fetchLinkSuggestions,
|
|
14
9
|
__experimentalFetchUrlData as fetchUrlData,
|
|
10
|
+
__experimentalFetchMedia as fetchMedia,
|
|
15
11
|
} from '@wordpress/core-data';
|
|
16
12
|
import { __ } from '@wordpress/i18n';
|
|
17
13
|
|
|
@@ -21,6 +17,8 @@ import { __ } from '@wordpress/i18n';
|
|
|
21
17
|
import { mediaUpload } from '../../utils';
|
|
22
18
|
import { store as editorStore } from '../../store';
|
|
23
19
|
|
|
20
|
+
const EMPTY_BLOCKS_LIST = [];
|
|
21
|
+
|
|
24
22
|
/**
|
|
25
23
|
* React hook used to compute the block editor settings to use for the post editor.
|
|
26
24
|
*
|
|
@@ -55,7 +53,7 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
55
53
|
'wp_block',
|
|
56
54
|
{ per_page: -1 }
|
|
57
55
|
)
|
|
58
|
-
:
|
|
56
|
+
: EMPTY_BLOCKS_LIST, // Reusable blocks are fetched in the native version of this hook.
|
|
59
57
|
hasUploadPermissions: canUser( 'create', 'media' ) ?? true,
|
|
60
58
|
userCanCreatePages: canUser( 'create', 'pages' ),
|
|
61
59
|
pageOnFront: siteSettings?.page_on_front,
|
|
@@ -133,56 +131,64 @@ function useBlockEditorSettings( settings, hasTemplate ) {
|
|
|
133
131
|
|
|
134
132
|
return useMemo(
|
|
135
133
|
() => ( {
|
|
136
|
-
...
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
134
|
+
...Object.fromEntries(
|
|
135
|
+
Object.entries( settings ).filter( ( [ key ] ) =>
|
|
136
|
+
[
|
|
137
|
+
'__experimentalBlockDirectory',
|
|
138
|
+
'__experimentalBlockInspectorTabs',
|
|
139
|
+
'__experimentalDiscussionSettings',
|
|
140
|
+
'__experimentalFeatures',
|
|
141
|
+
'__experimentalPreferredStyleVariations',
|
|
142
|
+
'__experimentalSetIsInserterOpened',
|
|
143
|
+
'__unstableGalleryWithImageBlocks',
|
|
144
|
+
'alignWide',
|
|
145
|
+
'allowedBlockTypes',
|
|
146
|
+
'bodyPlaceholder',
|
|
147
|
+
'canLockBlocks',
|
|
148
|
+
'codeEditingEnabled',
|
|
149
|
+
'colors',
|
|
150
|
+
'disableCustomColors',
|
|
151
|
+
'disableCustomFontSizes',
|
|
152
|
+
'disableCustomSpacingSizes',
|
|
153
|
+
'disableCustomGradients',
|
|
154
|
+
'disableLayoutStyles',
|
|
155
|
+
'enableCustomLineHeight',
|
|
156
|
+
'enableCustomSpacing',
|
|
157
|
+
'enableCustomUnits',
|
|
158
|
+
'focusMode',
|
|
159
|
+
'fontSizes',
|
|
160
|
+
'gradients',
|
|
161
|
+
'generateAnchors',
|
|
162
|
+
'hasFixedToolbar',
|
|
163
|
+
'isDistractionFree',
|
|
164
|
+
'hasInlineToolbar',
|
|
165
|
+
'imageDefaultSize',
|
|
166
|
+
'imageDimensions',
|
|
167
|
+
'imageEditing',
|
|
168
|
+
'imageSizes',
|
|
169
|
+
'isRTL',
|
|
170
|
+
'keepCaretInsideBlock',
|
|
171
|
+
'maxWidth',
|
|
172
|
+
'onUpdateDefaultBlockStyles',
|
|
173
|
+
'styles',
|
|
174
|
+
'template',
|
|
175
|
+
'templateLock',
|
|
176
|
+
'titlePlaceholder',
|
|
177
|
+
'supportsLayout',
|
|
178
|
+
'widgetTypesToHideFromLegacyWidgetBlock',
|
|
179
|
+
'__unstableResolvedAssets',
|
|
180
|
+
].includes( key )
|
|
181
|
+
)
|
|
182
|
+
),
|
|
180
183
|
mediaUpload: hasUploadPermissions ? mediaUpload : undefined,
|
|
181
184
|
__experimentalReusableBlocks: reusableBlocks,
|
|
182
185
|
__experimentalBlockPatterns: blockPatterns,
|
|
183
186
|
__experimentalBlockPatternCategories: blockPatternCategories,
|
|
184
187
|
__experimentalFetchLinkSuggestions: ( search, searchOptions ) =>
|
|
185
188
|
fetchLinkSuggestions( search, searchOptions, settings ),
|
|
189
|
+
// TODO: We should find a proper way to consolidate similar cases
|
|
190
|
+
// like reusable blocks, fetch entities, etc.
|
|
191
|
+
__unstableFetchMedia: fetchMedia,
|
|
186
192
|
__experimentalFetchRichUrlData: fetchUrlData,
|
|
187
193
|
__experimentalCanUserUseUnfilteredHTML: canUseUnfilteredHTML,
|
|
188
194
|
__experimentalUndo: undo,
|
|
@@ -11,6 +11,8 @@ import { store as coreStore } from '@wordpress/core-data';
|
|
|
11
11
|
import useBlockEditorSettings from './use-block-editor-settings.js';
|
|
12
12
|
import { store as editorStore } from '../../store';
|
|
13
13
|
|
|
14
|
+
const EMPTY_BLOCKS_LIST = [];
|
|
15
|
+
|
|
14
16
|
function useNativeBlockEditorSettings( settings, hasTemplate ) {
|
|
15
17
|
const capabilities = settings.capabilities ?? {};
|
|
16
18
|
const editorSettings = useBlockEditorSettings( settings, hasTemplate );
|
|
@@ -27,7 +29,7 @@ function useNativeBlockEditorSettings( settings, hasTemplate ) {
|
|
|
27
29
|
// Related issue: https://github.com/wordpress-mobile/gutenberg-mobile/issues/2661
|
|
28
30
|
{ per_page: 100 }
|
|
29
31
|
)
|
|
30
|
-
:
|
|
32
|
+
: EMPTY_BLOCKS_LIST,
|
|
31
33
|
isTitleSelected: select( editorStore ).isPostTitleSelected(),
|
|
32
34
|
};
|
|
33
35
|
},
|