@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.
Files changed (132) hide show
  1. package/CHANGELOG.md +8 -0
  2. package/build/components/document-outline/check.js +1 -7
  3. package/build/components/document-outline/check.js.map +1 -1
  4. package/build/components/editor-notices/index.js +12 -12
  5. package/build/components/editor-notices/index.js.map +1 -1
  6. package/build/components/editor-snackbars/index.js +5 -8
  7. package/build/components/editor-snackbars/index.js.map +1 -1
  8. package/build/components/entities-saved-states/entity-record-item.js +1 -0
  9. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  10. package/build/components/page-attributes/parent.js +2 -1
  11. package/build/components/page-attributes/parent.js.map +1 -1
  12. package/build/components/post-author/combobox.js +1 -0
  13. package/build/components/post-author/combobox.js.map +1 -1
  14. package/build/components/post-comments/index.js +1 -0
  15. package/build/components/post-comments/index.js.map +1 -1
  16. package/build/components/post-format/index.js +1 -7
  17. package/build/components/post-format/index.js.map +1 -1
  18. package/build/components/post-pending-status/index.js +1 -0
  19. package/build/components/post-pending-status/index.js.map +1 -1
  20. package/build/components/post-pingbacks/index.js +1 -0
  21. package/build/components/post-pingbacks/index.js.map +1 -1
  22. package/build/components/post-publish-button/index.js +10 -1
  23. package/build/components/post-publish-button/index.js.map +1 -1
  24. package/build/components/post-publish-panel/index.js +1 -0
  25. package/build/components/post-publish-panel/index.js.map +1 -1
  26. package/build/components/post-publish-panel/maybe-category-panel.js +10 -5
  27. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  28. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  29. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  30. package/build/components/post-saved-state/index.js +19 -5
  31. package/build/components/post-saved-state/index.js.map +1 -1
  32. package/build/components/post-sticky/index.js +1 -0
  33. package/build/components/post-sticky/index.js.map +1 -1
  34. package/build/components/post-taxonomies/flat-term-selector.js +2 -2
  35. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  36. package/build/components/post-taxonomies/hierarchical-term-selector.js +2 -1
  37. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  38. package/build/components/post-taxonomies/index.js +2 -8
  39. package/build/components/post-taxonomies/index.js.map +1 -1
  40. package/build/components/post-title/index.js +4 -2
  41. package/build/components/post-title/index.js.map +1 -1
  42. package/build/components/post-title/index.native.js +2 -4
  43. package/build/components/post-title/index.native.js.map +1 -1
  44. package/build/components/post-url/index.js +6 -2
  45. package/build/components/post-url/index.js.map +1 -1
  46. package/build/components/provider/index.native.js.map +1 -1
  47. package/build/components/provider/use-block-editor-settings.js +10 -9
  48. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  49. package/build/components/provider/use-block-editor-settings.native.js +3 -1
  50. package/build/components/provider/use-block-editor-settings.native.js.map +1 -1
  51. package/build-module/components/document-outline/check.js +1 -6
  52. package/build-module/components/document-outline/check.js.map +1 -1
  53. package/build-module/components/editor-notices/index.js +12 -11
  54. package/build-module/components/editor-notices/index.js.map +1 -1
  55. package/build-module/components/editor-snackbars/index.js +5 -7
  56. package/build-module/components/editor-snackbars/index.js.map +1 -1
  57. package/build-module/components/entities-saved-states/entity-record-item.js +1 -0
  58. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  59. package/build-module/components/page-attributes/parent.js +3 -2
  60. package/build-module/components/page-attributes/parent.js.map +1 -1
  61. package/build-module/components/post-author/combobox.js +1 -0
  62. package/build-module/components/post-author/combobox.js.map +1 -1
  63. package/build-module/components/post-comments/index.js +1 -0
  64. package/build-module/components/post-comments/index.js.map +1 -1
  65. package/build-module/components/post-format/index.js +1 -6
  66. package/build-module/components/post-format/index.js.map +1 -1
  67. package/build-module/components/post-pending-status/index.js +1 -0
  68. package/build-module/components/post-pending-status/index.js.map +1 -1
  69. package/build-module/components/post-pingbacks/index.js +1 -0
  70. package/build-module/components/post-pingbacks/index.js.map +1 -1
  71. package/build-module/components/post-publish-button/index.js +10 -1
  72. package/build-module/components/post-publish-button/index.js.map +1 -1
  73. package/build-module/components/post-publish-panel/index.js +1 -0
  74. package/build-module/components/post-publish-panel/index.js.map +1 -1
  75. package/build-module/components/post-publish-panel/maybe-category-panel.js +10 -5
  76. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  77. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  78. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  79. package/build-module/components/post-saved-state/index.js +19 -5
  80. package/build-module/components/post-saved-state/index.js.map +1 -1
  81. package/build-module/components/post-sticky/index.js +1 -0
  82. package/build-module/components/post-sticky/index.js.map +1 -1
  83. package/build-module/components/post-taxonomies/flat-term-selector.js +3 -3
  84. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  85. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  86. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  87. package/build-module/components/post-taxonomies/index.js +2 -7
  88. package/build-module/components/post-taxonomies/index.js.map +1 -1
  89. package/build-module/components/post-title/index.js +3 -2
  90. package/build-module/components/post-title/index.js.map +1 -1
  91. package/build-module/components/post-title/index.native.js +2 -3
  92. package/build-module/components/post-title/index.native.js.map +1 -1
  93. package/build-module/components/post-url/index.js +6 -2
  94. package/build-module/components/post-url/index.js.map +1 -1
  95. package/build-module/components/provider/index.native.js +2 -1
  96. package/build-module/components/provider/index.native.js.map +1 -1
  97. package/build-module/components/provider/use-block-editor-settings.js +10 -8
  98. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  99. package/build-module/components/provider/use-block-editor-settings.native.js +2 -1
  100. package/build-module/components/provider/use-block-editor-settings.native.js.map +1 -1
  101. package/build-style/style-rtl.css +17 -3
  102. package/build-style/style.css +17 -3
  103. package/package.json +31 -30
  104. package/src/components/document-outline/check.js +1 -7
  105. package/src/components/editor-help/test/index.native.js +2 -2
  106. package/src/components/editor-notices/index.js +6 -13
  107. package/src/components/editor-snackbars/index.js +3 -8
  108. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  109. package/src/components/page-attributes/parent.js +3 -3
  110. package/src/components/post-author/combobox.js +1 -0
  111. package/src/components/post-comments/index.js +1 -0
  112. package/src/components/post-format/index.js +1 -7
  113. package/src/components/post-pending-status/index.js +1 -0
  114. package/src/components/post-pingbacks/index.js +1 -0
  115. package/src/components/post-publish-button/index.js +11 -1
  116. package/src/components/post-publish-panel/index.js +1 -0
  117. package/src/components/post-publish-panel/maybe-category-panel.js +9 -12
  118. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  119. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -15
  120. package/src/components/post-saved-state/index.js +15 -3
  121. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  122. package/src/components/post-sticky/index.js +1 -0
  123. package/src/components/post-taxonomies/flat-term-selector.js +3 -3
  124. package/src/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  125. package/src/components/post-taxonomies/index.js +2 -8
  126. package/src/components/post-taxonomies/test/index.js +1 -1
  127. package/src/components/post-title/index.js +6 -2
  128. package/src/components/post-title/index.native.js +2 -3
  129. package/src/components/post-url/index.js +6 -2
  130. package/src/components/provider/index.native.js +1 -0
  131. package/src/components/provider/use-block-editor-settings.js +56 -50
  132. package/src/components/provider/use-block-editor-settings.native.js +3 -1
@@ -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 10px 10px rgba(0, 0, 0, 0.25);
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 #757575;
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 #757575;
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": "12.20.0",
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.21.0",
35
- "@wordpress/api-fetch": "^6.18.0",
36
- "@wordpress/blob": "^3.21.0",
37
- "@wordpress/block-editor": "^10.4.0",
38
- "@wordpress/blocks": "^11.20.0",
39
- "@wordpress/components": "^22.0.0",
40
- "@wordpress/compose": "^5.19.0",
41
- "@wordpress/core-data": "^5.4.0",
42
- "@wordpress/data": "^7.5.0",
43
- "@wordpress/date": "^4.21.0",
44
- "@wordpress/deprecated": "^3.21.0",
45
- "@wordpress/element": "^4.19.0",
46
- "@wordpress/hooks": "^3.21.0",
47
- "@wordpress/html-entities": "^3.21.0",
48
- "@wordpress/i18n": "^4.21.0",
49
- "@wordpress/icons": "^9.12.0",
50
- "@wordpress/keyboard-shortcuts": "^3.19.0",
51
- "@wordpress/keycodes": "^3.21.0",
52
- "@wordpress/media-utils": "^4.12.0",
53
- "@wordpress/notices": "^3.21.0",
54
- "@wordpress/preferences": "^2.13.0",
55
- "@wordpress/reusable-blocks": "^3.19.0",
56
- "@wordpress/rich-text": "^5.19.0",
57
- "@wordpress/server-side-render": "^3.19.0",
58
- "@wordpress/url": "^3.22.0",
59
- "@wordpress/wordcount": "^3.21.0",
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": "^17.0.0",
71
- "react-dom": "^17.0.0"
71
+ "react": "^18.0.0",
72
+ "react-dom": "^18.0.0"
72
73
  },
73
74
  "publishConfig": {
74
75
  "access": "public"
75
76
  },
76
- "gitHead": "511f4cc1f0138641bc4394bc1cf36e833109c791"
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.getAllByA11yLabel( 'Go back' );
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.findByA11yLabel( 'Go back' );
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( notices, {
21
- isDismissible: true,
22
- type: 'default',
23
- } );
24
- const nonDismissibleNotices = filter( notices, {
25
- isDismissible: false,
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( notices, {
20
- type: 'snackbar',
21
- } );
14
+ const snackbarNotices = notices.filter(
15
+ ( { type } ) => type === 'snackbar'
16
+ );
22
17
 
23
18
  return (
24
19
  <SnackbarList
@@ -77,6 +77,7 @@ export default function EntityRecordItem( {
77
77
  return (
78
78
  <PanelRow>
79
79
  <CheckboxControl
80
+ __nextHasNoMarginBottom
80
81
  label={
81
82
  <strong>
82
83
  { decodeEntities( entityRecordTitle ) ||
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, unescape as unescapeString, find } from 'lodash';
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 }
@@ -95,6 +95,7 @@ function PostAuthorCombobox() {
95
95
 
96
96
  return (
97
97
  <ComboboxControl
98
+ __nextHasNoMarginBottom
98
99
  label={ __( 'Author' ) }
99
100
  options={ authorOptions }
100
101
  value={ authorId }
@@ -19,6 +19,7 @@ function PostComments( { commentStatus = 'open', ...props } ) {
19
19
 
20
20
  return (
21
21
  <CheckboxControl
22
+ __nextHasNoMarginBottom
22
23
  label={ __( 'Allow comments' ) }
23
24
  checked={ commentStatus === 'open' }
24
25
  onChange={ onToggleComments }
@@ -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
 
@@ -21,6 +21,7 @@ export function PostPendingStatus( { status, onUpdateStatus } ) {
21
21
  return (
22
22
  <PostPendingStatusCheck>
23
23
  <CheckboxControl
24
+ __nextHasNoMarginBottom
24
25
  label={ __( 'Pending review' ) }
25
26
  checked={ status === 'pending' }
26
27
  onChange={ togglePendingStatus }
@@ -19,6 +19,7 @@ function PostPingbacks( { pingStatus = 'open', ...props } ) {
19
19
 
20
20
  return (
21
21
  <CheckboxControl
22
+ __nextHasNoMarginBottom
22
23
  label={ __( 'Allow pingbacks & trackbacks' ) }
23
24
  checked={ pingStatus === 'open' }
24
25
  onChange={ onTogglePingback }
@@ -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
- this.buttonNode.current.focus();
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 categoriesTaxonomy =
20
- select( coreStore ).getTaxonomy( 'category' );
21
- const defaultCategoryId = select( coreStore ).getEntityRecord(
22
- 'root',
23
- 'site'
24
- )?.default_category;
25
- const defaultCategory = select( coreStore ).getEntityRecord(
26
- 'taxonomy',
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.id === categories[ 0 ] ) )
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 { find, get } from 'lodash';
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( formats, ( format ) => format.id === suggestedPostFormat );
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-2 emotion-3"
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-2 emotion-3"
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
- shortcut={ displayShortcut.primary( 's' ) }
155
- variant={ isLargeViewport ? 'tertiary' : undefined }
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={ showIconLabels ? undefined : 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 } /> }
@@ -4,7 +4,7 @@ exports[`PostSavedState returns a disabled button if the post is not saveable 1`
4
4
  <button
5
5
  aria-disabled="true"
6
6
  aria-label="Save draft"
7
- class="components-button has-icon"
7
+ class="components-button is-tertiary has-icon"
8
8
  type="button"
9
9
  >
10
10
  <svg
@@ -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 { find, get } from 'lodash';
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( terms, ( term ) => isSameTermName( term.name, termName ) ).id
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( availableTerms, ( term ) =>
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 { find, get, unescape as unescapeString } from 'lodash';
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( terms, ( term ) => {
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 = filter( taxonomies, ( taxonomy ) =>
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( value, create( { html: content } ) );
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,