@wordpress/editor 12.19.0 → 12.21.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 (140) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/entities-saved-states/entity-record-item.js +1 -0
  3. package/build/components/entities-saved-states/entity-record-item.js.map +1 -1
  4. package/build/components/entities-saved-states/entity-type-list.js +1 -7
  5. package/build/components/entities-saved-states/entity-type-list.js.map +1 -1
  6. package/build/components/entities-saved-states/index.js +1 -1
  7. package/build/components/entities-saved-states/index.js.map +1 -1
  8. package/build/components/index.js +18 -0
  9. package/build/components/index.js.map +1 -1
  10. package/build/components/post-comments/index.js +1 -0
  11. package/build/components/post-comments/index.js.map +1 -1
  12. package/build/components/post-format/index.js +1 -1
  13. package/build/components/post-format/index.js.map +1 -1
  14. package/build/components/post-pending-status/index.js +1 -0
  15. package/build/components/post-pending-status/index.js.map +1 -1
  16. package/build/components/post-pingbacks/index.js +1 -0
  17. package/build/components/post-pingbacks/index.js.map +1 -1
  18. package/build/components/post-publish-button/index.js +11 -2
  19. package/build/components/post-publish-button/index.js.map +1 -1
  20. package/build/components/post-publish-panel/index.js +1 -0
  21. package/build/components/post-publish-panel/index.js.map +1 -1
  22. package/build/components/post-publish-panel/maybe-category-panel.js +1 -7
  23. package/build/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  24. package/build/components/post-publish-panel/maybe-post-format-panel.js +1 -1
  25. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  26. package/build/components/post-publish-panel/maybe-tags-panel.js +1 -7
  27. package/build/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  28. package/build/components/post-saved-state/index.js +19 -5
  29. package/build/components/post-saved-state/index.js.map +1 -1
  30. package/build/components/post-schedule/index.js +13 -16
  31. package/build/components/post-schedule/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/check.js +1 -7
  35. package/build/components/post-taxonomies/check.js.map +1 -1
  36. package/build/components/post-taxonomies/flat-term-selector.js +3 -1
  37. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  38. package/build/components/post-taxonomies/hierarchical-term-selector.js +3 -2
  39. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/index.js +1 -1
  41. package/build/components/post-taxonomies/index.js.map +1 -1
  42. package/build/components/post-title/index.js +4 -2
  43. package/build/components/post-title/index.js.map +1 -1
  44. package/build/components/post-type-support-check/index.js +1 -7
  45. package/build/components/post-type-support-check/index.js.map +1 -1
  46. package/build/components/theme-support-check/index.js +2 -2
  47. package/build/components/theme-support-check/index.js.map +1 -1
  48. package/build/components/time-to-read/index.js +2 -6
  49. package/build/components/time-to-read/index.js.map +1 -1
  50. package/build/store/selectors.js +1 -6
  51. package/build/store/selectors.js.map +1 -1
  52. package/build/store/utils/notice-builder.js +2 -2
  53. package/build/store/utils/notice-builder.js.map +1 -1
  54. package/build-module/components/entities-saved-states/entity-record-item.js +1 -0
  55. package/build-module/components/entities-saved-states/entity-record-item.js.map +1 -1
  56. package/build-module/components/entities-saved-states/entity-type-list.js +1 -6
  57. package/build-module/components/entities-saved-states/entity-type-list.js.map +1 -1
  58. package/build-module/components/entities-saved-states/index.js +2 -2
  59. package/build-module/components/entities-saved-states/index.js.map +1 -1
  60. package/build-module/components/index.js +3 -1
  61. package/build-module/components/index.js.map +1 -1
  62. package/build-module/components/post-comments/index.js +1 -0
  63. package/build-module/components/post-comments/index.js.map +1 -1
  64. package/build-module/components/post-format/index.js +2 -2
  65. package/build-module/components/post-format/index.js.map +1 -1
  66. package/build-module/components/post-pending-status/index.js +1 -0
  67. package/build-module/components/post-pending-status/index.js.map +1 -1
  68. package/build-module/components/post-pingbacks/index.js +1 -0
  69. package/build-module/components/post-pingbacks/index.js.map +1 -1
  70. package/build-module/components/post-publish-button/index.js +12 -3
  71. package/build-module/components/post-publish-button/index.js.map +1 -1
  72. package/build-module/components/post-publish-panel/index.js +1 -0
  73. package/build-module/components/post-publish-panel/index.js.map +1 -1
  74. package/build-module/components/post-publish-panel/maybe-category-panel.js +1 -6
  75. package/build-module/components/post-publish-panel/maybe-category-panel.js.map +1 -1
  76. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  77. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  78. package/build-module/components/post-publish-panel/maybe-tags-panel.js +1 -6
  79. package/build-module/components/post-publish-panel/maybe-tags-panel.js.map +1 -1
  80. package/build-module/components/post-saved-state/index.js +19 -5
  81. package/build-module/components/post-saved-state/index.js.map +1 -1
  82. package/build-module/components/post-schedule/index.js +12 -17
  83. package/build-module/components/post-schedule/index.js.map +1 -1
  84. package/build-module/components/post-sticky/index.js +1 -0
  85. package/build-module/components/post-sticky/index.js.map +1 -1
  86. package/build-module/components/post-taxonomies/check.js +1 -6
  87. package/build-module/components/post-taxonomies/check.js.map +1 -1
  88. package/build-module/components/post-taxonomies/flat-term-selector.js +3 -2
  89. package/build-module/components/post-taxonomies/flat-term-selector.js.map +1 -1
  90. package/build-module/components/post-taxonomies/hierarchical-term-selector.js +4 -3
  91. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  92. package/build-module/components/post-taxonomies/index.js +2 -2
  93. package/build-module/components/post-taxonomies/index.js.map +1 -1
  94. package/build-module/components/post-title/index.js +3 -2
  95. package/build-module/components/post-title/index.js.map +1 -1
  96. package/build-module/components/post-type-support-check/index.js +1 -6
  97. package/build-module/components/post-type-support-check/index.js.map +1 -1
  98. package/build-module/components/theme-support-check/index.js +3 -3
  99. package/build-module/components/theme-support-check/index.js.map +1 -1
  100. package/build-module/components/time-to-read/index.js +2 -6
  101. package/build-module/components/time-to-read/index.js.map +1 -1
  102. package/build-module/store/selectors.js +1 -6
  103. package/build-module/store/selectors.js.map +1 -1
  104. package/build-module/store/utils/notice-builder.js +3 -3
  105. package/build-module/store/utils/notice-builder.js.map +1 -1
  106. package/build-style/style-rtl.css +0 -4
  107. package/build-style/style.css +0 -4
  108. package/package.json +31 -28
  109. package/src/components/editor-help/test/index.native.js +2 -2
  110. package/src/components/entities-saved-states/entity-record-item.js +1 -0
  111. package/src/components/entities-saved-states/entity-type-list.js +1 -7
  112. package/src/components/entities-saved-states/index.js +2 -3
  113. package/src/components/index.js +2 -0
  114. package/src/components/post-comments/index.js +1 -0
  115. package/src/components/post-format/index.js +2 -2
  116. package/src/components/post-pending-status/index.js +1 -0
  117. package/src/components/post-pingbacks/index.js +1 -0
  118. package/src/components/post-publish-button/index.js +13 -4
  119. package/src/components/post-publish-panel/index.js +1 -0
  120. package/src/components/post-publish-panel/maybe-category-panel.js +1 -6
  121. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -2
  122. package/src/components/post-publish-panel/maybe-tags-panel.js +1 -6
  123. package/src/components/post-publish-panel/test/__snapshots__/index.js.snap +11 -15
  124. package/src/components/post-saved-state/index.js +15 -3
  125. package/src/components/post-saved-state/style.scss +0 -4
  126. package/src/components/post-saved-state/test/__snapshots__/index.js.snap +1 -1
  127. package/src/components/post-schedule/index.js +16 -20
  128. package/src/components/post-sticky/index.js +1 -0
  129. package/src/components/post-taxonomies/check.js +2 -7
  130. package/src/components/post-taxonomies/flat-term-selector.js +3 -2
  131. package/src/components/post-taxonomies/hierarchical-term-selector.js +4 -3
  132. package/src/components/post-taxonomies/index.js +2 -2
  133. package/src/components/post-text-editor/test/index.js +7 -3
  134. package/src/components/post-title/index.js +6 -2
  135. package/src/components/post-type-support-check/index.js +3 -9
  136. package/src/components/theme-support-check/index.js +5 -3
  137. package/src/components/time-to-read/index.js +2 -2
  138. package/src/store/selectors.js +1 -10
  139. package/src/store/test/selectors.js +2 -56
  140. package/src/store/utils/notice-builder.js +3 -3
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { some } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -67,8 +62,7 @@ export default function EntityTypeList( {
67
62
  key={ record.key || record.property }
68
63
  record={ record }
69
64
  checked={
70
- ! some(
71
- unselectedEntities,
65
+ ! unselectedEntities.some(
72
66
  ( elt ) =>
73
67
  elt.kind === record.kind &&
74
68
  elt.name === record.name &&
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { some, groupBy } from 'lodash';
4
+ import { groupBy } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -127,8 +127,7 @@ export default function EntitiesSavedStates( { close } ) {
127
127
  const saveCheckedEntities = () => {
128
128
  const entitiesToSave = dirtyEntityRecords.filter(
129
129
  ( { kind, name, key, property } ) => {
130
- return ! some(
131
- unselectedEntities,
130
+ return ! unselectedEntities.some(
132
131
  ( elt ) =>
133
132
  elt.kind === kind &&
134
133
  elt.name === name &&
@@ -72,6 +72,8 @@ export { default as TableOfContents } from './table-of-contents';
72
72
  export { default as ThemeSupportCheck } from './theme-support-check';
73
73
  export { default as UnsavedChangesWarning } from './unsaved-changes-warning';
74
74
  export { default as WordCount } from './word-count';
75
+ export { default as TimeToRead } from './time-to-read';
76
+ export { default as CharacterCount } from './character-count';
75
77
 
76
78
  // State Related Components.
77
79
  export { default as EditorProvider } from './provider';
@@ -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,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, includes } from 'lodash';
4
+ import { find } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -66,7 +66,7 @@ export default function PostFormat() {
66
66
  // Ensure current format is always in the set.
67
67
  // The current format may not be a format supported by the theme.
68
68
  return (
69
- includes( supportedFormats, format.id ) || postFormat === format.id
69
+ supportedFormats?.includes( format.id ) || postFormat === format.id
70
70
  );
71
71
  } );
72
72
  const suggestion = find(
@@ -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 }
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { get, some } from 'lodash';
4
+ import { get } from 'lodash';
5
5
  import classnames from 'classnames';
6
6
 
7
7
  /**
@@ -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 } =
@@ -77,8 +87,7 @@ export class PostPublishButton extends Component {
77
87
  this.setState( { entitiesSavedStatesCallback: false }, () => {
78
88
  if (
79
89
  savedEntities &&
80
- some(
81
- savedEntities,
90
+ savedEntities.some(
82
91
  ( elt ) =>
83
92
  elt.kind === 'postType' &&
84
93
  elt.name === postType &&
@@ -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 }
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { some } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -34,7 +29,7 @@ function MaybeCategoryPanel() {
34
29
  );
35
30
  const postTypeSupportsCategories =
36
31
  categoriesTaxonomy &&
37
- some( categoriesTaxonomy.types, ( type ) => type === postType );
32
+ categoriesTaxonomy.types.some( ( type ) => type === postType );
38
33
  const categories =
39
34
  categoriesTaxonomy &&
40
35
  select( editorStore ).getEditedPostAttribute(
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, get, includes } from 'lodash';
4
+ import { find, get } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -19,7 +19,7 @@ import { store as editorStore } from '../../store';
19
19
 
20
20
  const getSuggestion = ( supportedFormats, suggestedPostFormat ) => {
21
21
  const formats = POST_FORMATS.filter( ( format ) =>
22
- includes( supportedFormats, format.id )
22
+ supportedFormats?.includes( format.id )
23
23
  );
24
24
  return find( formats, ( format ) => format.id === suggestedPostFormat );
25
25
  };
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { some } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -79,7 +74,7 @@ export default compose(
79
74
  areTagsFetched: tagsTaxonomy !== undefined,
80
75
  isPostTypeSupported:
81
76
  tagsTaxonomy &&
82
- some( tagsTaxonomy.types, ( type ) => type === postType ),
77
+ tagsTaxonomy.types.some( ( type ) => type === postType ),
83
78
  hasTags: tags && tags.length,
84
79
  };
85
80
  } ),
@@ -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 } /> }
@@ -38,7 +38,3 @@
38
38
  .editor-post-save-draft.has-text.has-icon svg {
39
39
  margin-right: 0;
40
40
  }
41
-
42
- :root[dir="rtl"] .editor-post-saved-state.has-text.has-icon {
43
- justify-content: right;
44
- }
@@ -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
@@ -1,3 +1,8 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { parseISO, endOfMonth, startOfMonth } from 'date-fns';
5
+
1
6
  /**
2
7
  * WordPress dependencies
3
8
  */
@@ -12,15 +17,6 @@ import { store as coreStore } from '@wordpress/core-data';
12
17
  */
13
18
  import { store as editorStore } from '../../store';
14
19
 
15
- function getDayOfTheMonth( date = new Date(), firstDay = true ) {
16
- const d = new Date( date );
17
- return new Date(
18
- d.getFullYear(),
19
- d.getMonth() + ( firstDay ? 0 : 1 ),
20
- firstDay ? 1 : 0
21
- ).toISOString();
22
- }
23
-
24
20
  export default function PostSchedule( { onClose } ) {
25
21
  const { postDate, postType } = useSelect(
26
22
  ( select ) => ( {
@@ -34,7 +30,7 @@ export default function PostSchedule( { onClose } ) {
34
30
  const onUpdateDate = ( date ) => editPost( { date } );
35
31
 
36
32
  const [ previewedMonth, setPreviewedMonth ] = useState(
37
- getDayOfTheMonth( postDate )
33
+ startOfMonth( new Date( postDate ) )
38
34
  );
39
35
 
40
36
  // Pick up published and schduled site posts.
@@ -42,22 +38,20 @@ export default function PostSchedule( { onClose } ) {
42
38
  ( select ) =>
43
39
  select( coreStore ).getEntityRecords( 'postType', postType, {
44
40
  status: 'publish,future',
45
- after: getDayOfTheMonth( previewedMonth ),
46
- before: getDayOfTheMonth( previewedMonth, false ),
41
+ after: startOfMonth( previewedMonth ).toISOString(),
42
+ before: endOfMonth( previewedMonth ).toISOString(),
47
43
  exclude: [ select( editorStore ).getCurrentPostId() ],
44
+ per_page: 100,
45
+ _fields: 'id,date',
48
46
  } ),
49
47
  [ previewedMonth, postType ]
50
48
  );
51
49
 
52
50
  const events = useMemo(
53
51
  () =>
54
- ( eventsByPostType || [] ).map(
55
- ( { title, type, date: eventDate } ) => ( {
56
- title: title?.rendered,
57
- type,
58
- date: new Date( eventDate ),
59
- } )
60
- ),
52
+ ( eventsByPostType || [] ).map( ( { date: eventDate } ) => ( {
53
+ date: new Date( eventDate ),
54
+ } ) ),
61
55
  [ eventsByPostType ]
62
56
  );
63
57
 
@@ -80,7 +74,9 @@ export default function PostSchedule( { onClose } ) {
80
74
  onChange={ onUpdateDate }
81
75
  is12Hour={ is12HourTime }
82
76
  events={ events }
83
- onMonthPreviewed={ setPreviewedMonth }
77
+ onMonthPreviewed={ ( date ) =>
78
+ setPreviewedMonth( parseISO( date ) )
79
+ }
84
80
  onClose={ onClose }
85
81
  />
86
82
  );
@@ -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,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { some, includes } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -16,8 +11,8 @@ import { store as coreStore } from '@wordpress/core-data';
16
11
  import { store as editorStore } from '../../store';
17
12
 
18
13
  export function PostTaxonomiesCheck( { postType, taxonomies, children } ) {
19
- const hasTaxonomies = some( taxonomies, ( taxonomy ) =>
20
- includes( taxonomy.types, postType )
14
+ const hasTaxonomies = taxonomies?.some( ( taxonomy ) =>
15
+ taxonomy.types.includes( postType )
21
16
  );
22
17
  if ( ! hasTaxonomies ) {
23
18
  return null;
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { escape as escapeString, find, get } from 'lodash';
4
+ import { find, get } from 'lodash';
5
+ import escapeHtml from 'escape-html';
5
6
 
6
7
  /**
7
8
  * WordPress dependencies
@@ -55,7 +56,7 @@ const termNamesToIds = ( names, terms ) => {
55
56
 
56
57
  // Tries to create a term or fetch it if it already exists.
57
58
  function findOrCreateTerm( termName, restBase, namespace ) {
58
- const escapedTermName = escapeString( termName );
59
+ const escapedTermName = escapeHtml( termName );
59
60
 
60
61
  return apiFetch( {
61
62
  path: `/${ namespace }/${ restBase }`,
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { find, get, some, unescape as unescapeString, without } from 'lodash';
4
+ import { find, get, unescape as unescapeString } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -258,7 +258,7 @@ export function HierarchicalTermSelector( { slug } ) {
258
258
  const onChange = ( termId ) => {
259
259
  const hasTerm = terms.includes( termId );
260
260
  const newTerms = hasTerm
261
- ? without( terms, termId )
261
+ ? terms.filter( ( id ) => id !== termId )
262
262
  : [ ...terms, termId ];
263
263
  onUpdateTerms( newTerms );
264
264
  };
@@ -290,7 +290,7 @@ export function HierarchicalTermSelector( { slug } ) {
290
290
  const existingTerm = findTerm( availableTerms, formParent, formName );
291
291
  if ( existingTerm ) {
292
292
  // If the term we are adding exists but is not selected select it.
293
- if ( ! some( terms, ( term ) => term === existingTerm.id ) ) {
293
+ if ( ! terms.some( ( term ) => term === existingTerm.id ) ) {
294
294
  onUpdateTerms( [ ...terms, existingTerm.id ] );
295
295
  }
296
296
 
@@ -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,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { filter, includes } from 'lodash';
4
+ import { filter } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -26,7 +26,7 @@ export function PostTaxonomies( {
26
26
  taxonomyWrapper = identity,
27
27
  } ) {
28
28
  const availableTaxonomies = filter( taxonomies, ( taxonomy ) =>
29
- includes( taxonomy.types, postType )
29
+ taxonomy.types.includes( postType )
30
30
  );
31
31
  const visibleTaxonomies = filter(
32
32
  availableTaxonomies,
@@ -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
  /**
@@ -117,7 +117,9 @@ describe( 'PostTextEditor', () => {
117
117
  await user.clear( textarea );
118
118
 
119
119
  // Stop editing.
120
- textarea.blur();
120
+ act( () => {
121
+ textarea.blur();
122
+ } );
121
123
 
122
124
  expect( mockResetEditorBlocks ).toHaveBeenCalledWith( [] );
123
125
  } );
@@ -147,7 +149,9 @@ describe( 'PostTextEditor', () => {
147
149
 
148
150
  rerender( <PostTextEditor /> );
149
151
 
150
- textarea.blur();
152
+ act( () => {
153
+ textarea.blur();
154
+ } );
151
155
 
152
156
  expect( textarea ).toHaveValue( 'Goodbye World' );
153
157
  } );
@@ -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,
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { some, castArray } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -30,10 +25,9 @@ import { store as editorStore } from '../../store';
30
25
  export function PostTypeSupportCheck( { postType, children, supportKeys } ) {
31
26
  let isSupported = true;
32
27
  if ( postType ) {
33
- isSupported = some(
34
- castArray( supportKeys ),
35
- ( key ) => !! postType.supports[ key ]
36
- );
28
+ isSupported = (
29
+ Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
30
+ ).some( ( key ) => !! postType.supports[ key ] );
37
31
  }
38
32
 
39
33
  if ( ! isSupported ) {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import { castArray, includes, get, some } from 'lodash';
4
+ import { get } from 'lodash';
5
5
 
6
6
  /**
7
7
  * WordPress dependencies
@@ -20,14 +20,16 @@ export function ThemeSupportCheck( {
20
20
  postType,
21
21
  supportKeys,
22
22
  } ) {
23
- const isSupported = some( castArray( supportKeys ), ( key ) => {
23
+ const isSupported = (
24
+ Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
25
+ ).some( ( key ) => {
24
26
  const supported = get( themeSupports, [ key ], false );
25
27
  // 'post-thumbnails' can be boolean or an array of post types.
26
28
  // In the latter case, we need to verify `postType` exists
27
29
  // within `supported`. If `postType` isn't passed, then the check
28
30
  // should fail.
29
31
  if ( 'post-thumbnails' === key && Array.isArray( supported ) ) {
30
- return includes( supported, postType );
32
+ return supported.includes( postType );
31
33
  }
32
34
  return supported;
33
35
  } );
@@ -38,7 +38,7 @@ export default function TimeToRead() {
38
38
  const minutesToReadString =
39
39
  minutesToRead === 0
40
40
  ? createInterpolateElement( __( '<span>< 1</span> minute' ), {
41
- span: <span className="table-of-contents__number" />,
41
+ span: <span />,
42
42
  } )
43
43
  : createInterpolateElement(
44
44
  sprintf(
@@ -51,7 +51,7 @@ export default function TimeToRead() {
51
51
  minutesToRead
52
52
  ),
53
53
  {
54
- span: <span className="table-of-contents__number" />,
54
+ span: <span />,
55
55
  }
56
56
  );
57
57
 
@@ -95,16 +95,7 @@ export function isEditedPostNew( state ) {
95
95
  */
96
96
  export function hasChangedContent( state ) {
97
97
  const edits = getPostEdits( state );
98
-
99
- return (
100
- 'blocks' in edits ||
101
- // `edits` is intended to contain only values which are different from
102
- // the saved post, so the mere presence of a property is an indicator
103
- // that the value is different than what is known to be saved. While
104
- // content in Visual mode is represented by the blocks state, in Text
105
- // mode it is tracked by `edits.content`.
106
- 'content' in edits
107
- );
98
+ return 'content' in edits;
108
99
  }
109
100
 
110
101
  /**