@wordpress/editor 12.20.0 → 13.0.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-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/entities-saved-states/entity-record-item.js +1 -0
- package/build/components/entities-saved-states/entity-record-item.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-comments/index.js +1 -0
- package/build/components/post-comments/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-pending-status/index.js +1 -0
- package/build/components/post-pending-status/index.js.map +1 -1
- package/build/components/post-pingbacks/index.js +1 -0
- package/build/components/post-pingbacks/index.js.map +1 -1
- package/build/components/post-publish-button/index.js +10 -1
- package/build/components/post-publish-button/index.js.map +1 -1
- package/build/components/post-publish-panel/index.js +1 -0
- package/build/components/post-publish-panel/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-saved-state/index.js +19 -5
- package/build/components/post-saved-state/index.js.map +1 -1
- package/build/components/post-sticky/index.js +1 -0
- package/build/components/post-sticky/index.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 +2 -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.js +4 -2
- package/build/components/post-title/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.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-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/entities-saved-states/entity-record-item.js +1 -0
- package/build-module/components/entities-saved-states/entity-record-item.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-comments/index.js +1 -0
- package/build-module/components/post-comments/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-pending-status/index.js +1 -0
- package/build-module/components/post-pending-status/index.js.map +1 -1
- package/build-module/components/post-pingbacks/index.js +1 -0
- package/build-module/components/post-pingbacks/index.js.map +1 -1
- package/build-module/components/post-publish-button/index.js +10 -1
- package/build-module/components/post-publish-button/index.js.map +1 -1
- package/build-module/components/post-publish-panel/index.js +1 -0
- package/build-module/components/post-publish-panel/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-saved-state/index.js +19 -5
- package/build-module/components/post-saved-state/index.js.map +1 -1
- package/build-module/components/post-sticky/index.js +1 -0
- package/build-module/components/post-sticky/index.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 +3 -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.js +3 -2
- package/build-module/components/post-title/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 +2 -1
- 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 +17 -3
- package/build-style/style.css +17 -3
- package/package.json +31 -30
- package/src/components/document-outline/check.js +1 -7
- package/src/components/editor-help/test/index.native.js +2 -2
- package/src/components/editor-notices/index.js +6 -13
- package/src/components/editor-snackbars/index.js +3 -8
- package/src/components/entities-saved-states/entity-record-item.js +1 -0
- package/src/components/page-attributes/parent.js +3 -3
- package/src/components/post-author/combobox.js +1 -0
- package/src/components/post-comments/index.js +1 -0
- package/src/components/post-format/index.js +1 -7
- package/src/components/post-pending-status/index.js +1 -0
- package/src/components/post-pingbacks/index.js +1 -0
- package/src/components/post-publish-button/index.js +11 -1
- package/src/components/post-publish-panel/index.js +1 -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-publish-panel/test/__snapshots__/index.js.snap +11 -15
- package/src/components/post-saved-state/index.js +15 -3
- package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
- package/src/components/post-sticky/index.js +1 -0
- package/src/components/post-taxonomies/flat-term-selector.js +3 -3
- package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -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.js +6 -2
- 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 +1 -0
- package/src/components/provider/use-block-editor-settings.js +56 -50
- package/src/components/provider/use-block-editor-settings.native.js +3 -1
package/build-style/style.css
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
@charset "UTF-8";
|
|
2
|
+
/**
|
|
3
|
+
* Converts a hex value into the rgb equivalent.
|
|
4
|
+
*
|
|
5
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
6
|
+
* @return {string} comma separated rgb values
|
|
7
|
+
*/
|
|
2
8
|
/**
|
|
3
9
|
* Colors
|
|
4
10
|
*/
|
|
@@ -12,6 +18,12 @@
|
|
|
12
18
|
* Don't add to this sheet unless you're pretty sure the value will be reused in many places.
|
|
13
19
|
* For example, don't add rules to this sheet that affect block visuals. It's purely for UI.
|
|
14
20
|
*/
|
|
21
|
+
/**
|
|
22
|
+
* Converts a hex value into the rgb equivalent.
|
|
23
|
+
*
|
|
24
|
+
* @param {string} hex - the hexadecimal value to convert
|
|
25
|
+
* @return {string} comma separated rgb values
|
|
26
|
+
*/
|
|
15
27
|
/**
|
|
16
28
|
* Colors
|
|
17
29
|
*/
|
|
@@ -83,6 +95,8 @@
|
|
|
83
95
|
--wp-admin-theme-color-darker-20: #005a87;
|
|
84
96
|
--wp-admin-theme-color-darker-20--rgb: 0, 90, 135;
|
|
85
97
|
--wp-admin-border-width-focus: 2px;
|
|
98
|
+
--wp-block-synced-color: #7a00df;
|
|
99
|
+
--wp-block-synced-color--rgb: 122, 0, 223;
|
|
86
100
|
}
|
|
87
101
|
@media (-webkit-min-device-pixel-ratio: 2), (min-resolution: 192dpi) {
|
|
88
102
|
:root {
|
|
@@ -277,7 +291,7 @@
|
|
|
277
291
|
max-width: 780px;
|
|
278
292
|
padding: 20px;
|
|
279
293
|
margin-top: 60px;
|
|
280
|
-
box-shadow: 0
|
|
294
|
+
box-shadow: 0 0.7px 1px rgba(0, 0, 0, 0.15), 0 2.7px 3.8px -0.2px rgba(0, 0, 0, 0.15), 0 5.5px 7.8px -0.3px rgba(0, 0, 0, 0.15), 0.1px 11.5px 16.4px -0.5px rgba(0, 0, 0, 0.15);
|
|
281
295
|
}
|
|
282
296
|
|
|
283
297
|
.editor-page-attributes__order {
|
|
@@ -751,7 +765,7 @@
|
|
|
751
765
|
box-shadow: 0 0 0 transparent;
|
|
752
766
|
transition: box-shadow 0.1s linear;
|
|
753
767
|
border-radius: 2px;
|
|
754
|
-
border: 1px solid #
|
|
768
|
+
border: 1px solid #949494;
|
|
755
769
|
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
756
770
|
font-size: 16px;
|
|
757
771
|
/* Override core line-height. To be reviewed. */
|
|
@@ -839,7 +853,7 @@
|
|
|
839
853
|
box-shadow: 0 0 0 transparent;
|
|
840
854
|
transition: box-shadow 0.1s linear;
|
|
841
855
|
border-radius: 2px;
|
|
842
|
-
border: 1px solid #
|
|
856
|
+
border: 1px solid #949494;
|
|
843
857
|
/* Fonts smaller than 16px causes mobile safari to zoom. */
|
|
844
858
|
font-size: 16px;
|
|
845
859
|
/* Override core line-height. To be reviewed. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wordpress/editor",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "13.0.0",
|
|
4
4
|
"description": "Enhanced block editor for WordPress posts.",
|
|
5
5
|
"author": "The WordPress Contributors",
|
|
6
6
|
"license": "GPL-2.0-or-later",
|
|
@@ -31,32 +31,33 @@
|
|
|
31
31
|
],
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/runtime": "^7.16.0",
|
|
34
|
-
"@wordpress/a11y": "^3.
|
|
35
|
-
"@wordpress/api-fetch": "^6.
|
|
36
|
-
"@wordpress/blob": "^3.
|
|
37
|
-
"@wordpress/block-editor": "^
|
|
38
|
-
"@wordpress/blocks": "^
|
|
39
|
-
"@wordpress/components": "^
|
|
40
|
-
"@wordpress/compose": "^
|
|
41
|
-
"@wordpress/core-data": "^
|
|
42
|
-
"@wordpress/data": "^
|
|
43
|
-
"@wordpress/date": "^4.
|
|
44
|
-
"@wordpress/deprecated": "^3.
|
|
45
|
-
"@wordpress/
|
|
46
|
-
"@wordpress/
|
|
47
|
-
"@wordpress/
|
|
48
|
-
"@wordpress/
|
|
49
|
-
"@wordpress/
|
|
50
|
-
"@wordpress/
|
|
51
|
-
"@wordpress/
|
|
52
|
-
"@wordpress/
|
|
53
|
-
"@wordpress/
|
|
54
|
-
"@wordpress/
|
|
55
|
-
"@wordpress/
|
|
56
|
-
"@wordpress/
|
|
57
|
-
"@wordpress/
|
|
58
|
-
"@wordpress/
|
|
59
|
-
"@wordpress/
|
|
34
|
+
"@wordpress/a11y": "^3.23.0",
|
|
35
|
+
"@wordpress/api-fetch": "^6.20.0",
|
|
36
|
+
"@wordpress/blob": "^3.23.0",
|
|
37
|
+
"@wordpress/block-editor": "^11.0.0",
|
|
38
|
+
"@wordpress/blocks": "^12.0.0",
|
|
39
|
+
"@wordpress/components": "^23.0.0",
|
|
40
|
+
"@wordpress/compose": "^6.0.0",
|
|
41
|
+
"@wordpress/core-data": "^6.0.0",
|
|
42
|
+
"@wordpress/data": "^8.0.0",
|
|
43
|
+
"@wordpress/date": "^4.23.0",
|
|
44
|
+
"@wordpress/deprecated": "^3.23.0",
|
|
45
|
+
"@wordpress/dom": "^3.23.0",
|
|
46
|
+
"@wordpress/element": "^5.0.0",
|
|
47
|
+
"@wordpress/hooks": "^3.23.0",
|
|
48
|
+
"@wordpress/html-entities": "^3.23.0",
|
|
49
|
+
"@wordpress/i18n": "^4.23.0",
|
|
50
|
+
"@wordpress/icons": "^9.14.0",
|
|
51
|
+
"@wordpress/keyboard-shortcuts": "^4.0.0",
|
|
52
|
+
"@wordpress/keycodes": "^3.23.0",
|
|
53
|
+
"@wordpress/media-utils": "^4.14.0",
|
|
54
|
+
"@wordpress/notices": "^3.23.0",
|
|
55
|
+
"@wordpress/preferences": "^3.0.0",
|
|
56
|
+
"@wordpress/reusable-blocks": "^4.0.0",
|
|
57
|
+
"@wordpress/rich-text": "^6.0.0",
|
|
58
|
+
"@wordpress/server-side-render": "^4.0.0",
|
|
59
|
+
"@wordpress/url": "^3.24.0",
|
|
60
|
+
"@wordpress/wordcount": "^3.23.0",
|
|
60
61
|
"classnames": "^2.3.1",
|
|
61
62
|
"date-fns": "^2.28.0",
|
|
62
63
|
"escape-html": "^1.0.3",
|
|
@@ -67,11 +68,11 @@
|
|
|
67
68
|
"remove-accents": "^0.4.2"
|
|
68
69
|
},
|
|
69
70
|
"peerDependencies": {
|
|
70
|
-
"react": "^
|
|
71
|
-
"react-dom": "^
|
|
71
|
+
"react": "^18.0.0",
|
|
72
|
+
"react-dom": "^18.0.0"
|
|
72
73
|
},
|
|
73
74
|
"publishConfig": {
|
|
74
75
|
"access": "public"
|
|
75
76
|
},
|
|
76
|
-
"gitHead": "
|
|
77
|
+
"gitHead": "1eb65aabe6738097f4c062e78f69ae8f05879848"
|
|
77
78
|
}
|
|
@@ -1,8 +1,3 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* External dependencies
|
|
3
|
-
*/
|
|
4
|
-
import { filter } from 'lodash';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* WordPress dependencies
|
|
8
3
|
*/
|
|
@@ -10,8 +5,7 @@ import { withSelect } from '@wordpress/data';
|
|
|
10
5
|
import { store as blockEditorStore } from '@wordpress/block-editor';
|
|
11
6
|
|
|
12
7
|
function DocumentOutlineCheck( { blocks, children } ) {
|
|
13
|
-
const headings = filter(
|
|
14
|
-
blocks,
|
|
8
|
+
const headings = blocks.filter(
|
|
15
9
|
( block ) => block.name === 'core/heading'
|
|
16
10
|
);
|
|
17
11
|
|
|
@@ -32,7 +32,7 @@ it( 'navigates back from help topic detail screen', async () => {
|
|
|
32
32
|
const helpTopic = await screen.findByText( 'Customize blocks' );
|
|
33
33
|
fireEvent.press( helpTopic );
|
|
34
34
|
|
|
35
|
-
const backButton = screen.
|
|
35
|
+
const backButton = screen.getAllByLabelText( 'Go back' );
|
|
36
36
|
fireEvent.press( backButton[ backButton.length - 1 ] );
|
|
37
37
|
|
|
38
38
|
// Currently logs `act` warning due to https://github.com/callstack/react-native-testing-library/issues/379
|
|
@@ -46,7 +46,7 @@ it( 'navigates back from help topic detail screen', async () => {
|
|
|
46
46
|
it( 'dismisses when close button is pressed', async () => {
|
|
47
47
|
const closeMock = jest.fn();
|
|
48
48
|
const screen = render( <EditorHelp isVisible close={ closeMock } /> );
|
|
49
|
-
const closeButton = await screen.
|
|
49
|
+
const closeButton = await screen.findByLabelText( 'Go back' );
|
|
50
50
|
fireEvent.press( closeButton );
|
|
51
51
|
|
|
52
52
|
expect( closeMock ).toHaveBeenCalled();
|
|
@@ -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 }
|
|
@@ -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
|
|
|
@@ -34,12 +34,22 @@ export class PostPublishButton extends Component {
|
|
|
34
34
|
entitiesSavedStatesCallback: false,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
+
|
|
37
38
|
componentDidMount() {
|
|
38
39
|
if ( this.props.focusOnMount ) {
|
|
39
|
-
|
|
40
|
+
// This timeout is necessary to make sure the `useEffect` hook of
|
|
41
|
+
// `useFocusReturn` gets the correct element (the button that opens the
|
|
42
|
+
// PostPublishPanel) otherwise it will get this button.
|
|
43
|
+
this.timeoutID = setTimeout( () => {
|
|
44
|
+
this.buttonNode.current.focus();
|
|
45
|
+
}, 0 );
|
|
40
46
|
}
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
componentWillUnmount() {
|
|
50
|
+
clearTimeout( this.timeoutID );
|
|
51
|
+
}
|
|
52
|
+
|
|
43
53
|
createOnClick( callback ) {
|
|
44
54
|
return ( ...args ) => {
|
|
45
55
|
const { hasNonPostEntityChanges, setEntitiesSavedStatesCallback } =
|
|
@@ -125,6 +125,7 @@ export class PostPublishPanel extends Component {
|
|
|
125
125
|
</div>
|
|
126
126
|
<div className="editor-post-publish-panel__footer">
|
|
127
127
|
<CheckboxControl
|
|
128
|
+
__nextHasNoMarginBottom
|
|
128
129
|
label={ __( 'Always show pre-publish checks.' ) }
|
|
129
130
|
checked={ isPublishSidebarEnabled }
|
|
130
131
|
onChange={ onTogglePublishSidebar }
|
|
@@ -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 = ( {
|
|
@@ -31,6 +31,10 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
31
31
|
padding: 0;
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
+
.components-panel__row .emotion-8 {
|
|
35
|
+
margin-bottom: inherit;
|
|
36
|
+
}
|
|
37
|
+
|
|
34
38
|
<div>
|
|
35
39
|
<div
|
|
36
40
|
class="editor-post-publish-panel"
|
|
@@ -141,7 +145,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
|
|
|
141
145
|
class="components-base-control components-checkbox-control emotion-0 emotion-1"
|
|
142
146
|
>
|
|
143
147
|
<div
|
|
144
|
-
class="components-base-control__field emotion-
|
|
148
|
+
class="components-base-control__field emotion-8 emotion-3"
|
|
145
149
|
>
|
|
146
150
|
<span
|
|
147
151
|
class="components-checkbox-control__input-container"
|
|
@@ -197,6 +201,10 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
197
201
|
padding: 0;
|
|
198
202
|
}
|
|
199
203
|
|
|
204
|
+
.components-panel__row .emotion-8 {
|
|
205
|
+
margin-bottom: inherit;
|
|
206
|
+
}
|
|
207
|
+
|
|
200
208
|
<div>
|
|
201
209
|
<div
|
|
202
210
|
class="editor-post-publish-panel"
|
|
@@ -307,7 +315,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
|
|
|
307
315
|
class="components-base-control components-checkbox-control emotion-0 emotion-1"
|
|
308
316
|
>
|
|
309
317
|
<div
|
|
310
|
-
class="components-base-control__field emotion-
|
|
318
|
+
class="components-base-control__field emotion-8 emotion-3"
|
|
311
319
|
>
|
|
312
320
|
<span
|
|
313
321
|
class="components-checkbox-control__input-container"
|
|
@@ -345,10 +353,6 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
|
|
|
345
353
|
box-sizing: inherit;
|
|
346
354
|
}
|
|
347
355
|
|
|
348
|
-
.emotion-2 {
|
|
349
|
-
margin-bottom: calc(4px * 2);
|
|
350
|
-
}
|
|
351
|
-
|
|
352
356
|
.components-panel__row .emotion-2 {
|
|
353
357
|
margin-bottom: inherit;
|
|
354
358
|
}
|
|
@@ -472,10 +476,6 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
|
|
|
472
476
|
box-sizing: inherit;
|
|
473
477
|
}
|
|
474
478
|
|
|
475
|
-
.emotion-2 {
|
|
476
|
-
margin-bottom: calc(4px * 2);
|
|
477
|
-
}
|
|
478
|
-
|
|
479
479
|
.components-panel__row .emotion-2 {
|
|
480
480
|
margin-bottom: inherit;
|
|
481
481
|
}
|
|
@@ -609,7 +609,7 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
609
609
|
display: inline-block;
|
|
610
610
|
margin: 5px 11px 0;
|
|
611
611
|
position: relative;
|
|
612
|
-
color: var( --wp-admin-theme-color );
|
|
612
|
+
color: var(--wp-components-color-accent, var(--wp-admin-theme-color, #007cba));
|
|
613
613
|
overflow: visible;
|
|
614
614
|
}
|
|
615
615
|
|
|
@@ -641,10 +641,6 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
|
|
|
641
641
|
box-sizing: inherit;
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
.emotion-8 {
|
|
645
|
-
margin-bottom: calc(4px * 2);
|
|
646
|
-
}
|
|
647
|
-
|
|
648
644
|
.components-panel__row .emotion-8 {
|
|
649
645
|
margin-bottom: inherit;
|
|
650
646
|
}
|
|
@@ -151,10 +151,22 @@ export default function PostSavedState( {
|
|
|
151
151
|
: undefined
|
|
152
152
|
}
|
|
153
153
|
onClick={ isDisabled ? undefined : () => savePost() }
|
|
154
|
-
|
|
155
|
-
|
|
154
|
+
/*
|
|
155
|
+
* We want the tooltip to show the keyboard shortcut only when the
|
|
156
|
+
* button does something, i.e. when it's not disabled.
|
|
157
|
+
*/
|
|
158
|
+
shortcut={ isDisabled ? undefined : displayShortcut.primary( 's' ) }
|
|
159
|
+
/*
|
|
160
|
+
* Displaying the keyboard shortcut conditionally makes the tooltip
|
|
161
|
+
* itself show conditionally. This would trigger a full-rerendering
|
|
162
|
+
* of the button that we want to avoid. By setting `showTooltip`,
|
|
163
|
+
& the tooltip is always rendered even when there's no keyboard shortcut.
|
|
164
|
+
*/
|
|
165
|
+
showTooltip
|
|
166
|
+
variant="tertiary"
|
|
156
167
|
icon={ isLargeViewport ? undefined : cloudUpload }
|
|
157
|
-
label
|
|
168
|
+
// Make sure the aria-label has always a value, as the default `text` is undefined on small screens.
|
|
169
|
+
label={ text || label }
|
|
158
170
|
aria-disabled={ isDisabled }
|
|
159
171
|
>
|
|
160
172
|
{ isSavedState && <Icon icon={ isSaved ? check : cloud } /> }
|
|
@@ -16,6 +16,7 @@ export function PostSticky( { onUpdateSticky, postSticky = false } ) {
|
|
|
16
16
|
return (
|
|
17
17
|
<PostStickyCheck>
|
|
18
18
|
<CheckboxControl
|
|
19
|
+
__nextHasNoMarginBottom
|
|
19
20
|
label={ __( 'Stick to the top of the blog' ) }
|
|
20
21
|
checked={ postSticky }
|
|
21
22
|
onChange={ () => onUpdateSticky( ! postSticky ) }
|
|
@@ -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 ) ) &&
|
|
@@ -358,6 +358,7 @@ export function HierarchicalTermSelector( { slug } ) {
|
|
|
358
358
|
className="editor-post-taxonomies__hierarchical-terms-choice"
|
|
359
359
|
>
|
|
360
360
|
<CheckboxControl
|
|
361
|
+
__nextHasNoMarginBottom
|
|
361
362
|
checked={ terms.indexOf( term.id ) !== -1 }
|
|
362
363
|
onChange={ () => {
|
|
363
364
|
const termId = parseInt( term.id, 10 );
|
|
@@ -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 } />
|
|
@@ -26,6 +26,7 @@ import {
|
|
|
26
26
|
insert,
|
|
27
27
|
} from '@wordpress/rich-text';
|
|
28
28
|
import { useMergeRefs } from '@wordpress/compose';
|
|
29
|
+
import { __unstableStripHTML as stripHTML } from '@wordpress/dom';
|
|
29
30
|
|
|
30
31
|
/**
|
|
31
32
|
* Internal dependencies
|
|
@@ -166,7 +167,7 @@ function PostTitle( _, forwardedRef ) {
|
|
|
166
167
|
( firstBlock.name === 'core/heading' ||
|
|
167
168
|
firstBlock.name === 'core/paragraph' )
|
|
168
169
|
) {
|
|
169
|
-
onUpdate( firstBlock.attributes.content );
|
|
170
|
+
onUpdate( stripHTML( firstBlock.attributes.content ) );
|
|
170
171
|
onInsertBlockAfter( content.slice( 1 ) );
|
|
171
172
|
} else {
|
|
172
173
|
onInsertBlockAfter( content );
|
|
@@ -176,7 +177,10 @@ function PostTitle( _, forwardedRef ) {
|
|
|
176
177
|
...create( { html: title } ),
|
|
177
178
|
...selection,
|
|
178
179
|
};
|
|
179
|
-
const newValue = insert(
|
|
180
|
+
const newValue = insert(
|
|
181
|
+
value,
|
|
182
|
+
create( { html: stripHTML( content ) } )
|
|
183
|
+
);
|
|
180
184
|
onUpdate( toHTMLString( { value: newValue } ) );
|
|
181
185
|
setSelection( {
|
|
182
186
|
start: newValue.start,
|