@wordpress/editor 13.4.0 → 13.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (133) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/components/document-outline/index.js +7 -1
  3. package/build/components/document-outline/index.js.map +1 -1
  4. package/build/components/editor-help/index.native.js +13 -10
  5. package/build/components/editor-help/index.native.js.map +1 -1
  6. package/build/components/media-categories/index.js +1 -1
  7. package/build/components/media-categories/index.js.map +1 -1
  8. package/build/components/page-attributes/check.js +6 -10
  9. package/build/components/page-attributes/check.js.map +1 -1
  10. package/build/components/page-attributes/parent.js +9 -6
  11. package/build/components/page-attributes/parent.js.map +1 -1
  12. package/build/components/post-author/check.js +3 -7
  13. package/build/components/post-author/check.js.map +1 -1
  14. package/build/components/post-featured-image/index.js +7 -12
  15. package/build/components/post-featured-image/index.js.map +1 -1
  16. package/build/components/post-locked-modal/index.js +1 -7
  17. package/build/components/post-locked-modal/index.js.map +1 -1
  18. package/build/components/post-pending-status/check.js +3 -7
  19. package/build/components/post-pending-status/check.js.map +1 -1
  20. package/build/components/post-preview-button/index.js +3 -3
  21. package/build/components/post-preview-button/index.js.map +1 -1
  22. package/build/components/post-publish-button/index.js +4 -4
  23. package/build/components/post-publish-button/index.js.map +1 -1
  24. package/build/components/post-publish-button/label.js +3 -7
  25. package/build/components/post-publish-button/label.js.map +1 -1
  26. package/build/components/post-publish-panel/index.js +4 -8
  27. package/build/components/post-publish-panel/index.js.map +1 -1
  28. package/build/components/post-publish-panel/maybe-post-format-panel.js +3 -7
  29. package/build/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  30. package/build/components/post-publish-panel/postpublish.js +5 -9
  31. package/build/components/post-publish-panel/postpublish.js.map +1 -1
  32. package/build/components/post-publish-panel/prepublish.js +3 -7
  33. package/build/components/post-publish-panel/prepublish.js.map +1 -1
  34. package/build/components/post-schedule/check.js +3 -7
  35. package/build/components/post-schedule/check.js.map +1 -1
  36. package/build/components/post-sticky/check.js +3 -7
  37. package/build/components/post-sticky/check.js.map +1 -1
  38. package/build/components/post-taxonomies/flat-term-selector.js +12 -7
  39. package/build/components/post-taxonomies/flat-term-selector.js.map +1 -1
  40. package/build/components/post-taxonomies/hierarchical-term-selector.js +18 -12
  41. package/build/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  42. package/build/components/post-taxonomies/most-used-terms.js +1 -8
  43. package/build/components/post-taxonomies/most-used-terms.js.map +1 -1
  44. package/build/components/post-visibility/check.js +3 -7
  45. package/build/components/post-visibility/check.js.map +1 -1
  46. package/build/components/provider/use-block-editor-settings.js +1 -1
  47. package/build/components/provider/use-block-editor-settings.js.map +1 -1
  48. package/build/components/theme-support-check/index.js +3 -7
  49. package/build/components/theme-support-check/index.js.map +1 -1
  50. package/build/store/utils/notice-builder.js +4 -8
  51. package/build/store/utils/notice-builder.js.map +1 -1
  52. package/build-module/components/document-outline/index.js +8 -2
  53. package/build-module/components/document-outline/index.js.map +1 -1
  54. package/build-module/components/editor-help/index.native.js +13 -9
  55. package/build-module/components/editor-help/index.native.js.map +1 -1
  56. package/build-module/components/media-categories/index.js +1 -1
  57. package/build-module/components/media-categories/index.js.map +1 -1
  58. package/build-module/components/page-attributes/check.js +6 -9
  59. package/build-module/components/page-attributes/check.js.map +1 -1
  60. package/build-module/components/page-attributes/parent.js +9 -5
  61. package/build-module/components/page-attributes/parent.js.map +1 -1
  62. package/build-module/components/post-author/check.js +3 -6
  63. package/build-module/components/post-author/check.js.map +1 -1
  64. package/build-module/components/post-featured-image/index.js +7 -11
  65. package/build-module/components/post-featured-image/index.js.map +1 -1
  66. package/build-module/components/post-locked-modal/index.js +1 -6
  67. package/build-module/components/post-locked-modal/index.js.map +1 -1
  68. package/build-module/components/post-pending-status/check.js +3 -6
  69. package/build-module/components/post-pending-status/check.js.map +1 -1
  70. package/build-module/components/post-preview-button/index.js +3 -2
  71. package/build-module/components/post-preview-button/index.js.map +1 -1
  72. package/build-module/components/post-publish-button/index.js +4 -3
  73. package/build-module/components/post-publish-button/index.js.map +1 -1
  74. package/build-module/components/post-publish-button/label.js +3 -6
  75. package/build-module/components/post-publish-button/label.js.map +1 -1
  76. package/build-module/components/post-publish-panel/index.js +4 -7
  77. package/build-module/components/post-publish-panel/index.js.map +1 -1
  78. package/build-module/components/post-publish-panel/maybe-post-format-panel.js +3 -6
  79. package/build-module/components/post-publish-panel/maybe-post-format-panel.js.map +1 -1
  80. package/build-module/components/post-publish-panel/postpublish.js +5 -8
  81. package/build-module/components/post-publish-panel/postpublish.js.map +1 -1
  82. package/build-module/components/post-publish-panel/prepublish.js +3 -6
  83. package/build-module/components/post-publish-panel/prepublish.js.map +1 -1
  84. package/build-module/components/post-schedule/check.js +3 -6
  85. package/build-module/components/post-schedule/check.js.map +1 -1
  86. package/build-module/components/post-sticky/check.js +3 -6
  87. package/build-module/components/post-sticky/check.js.map +1 -1
  88. package/build-module/components/post-taxonomies/flat-term-selector.js +12 -6
  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 +18 -11
  91. package/build-module/components/post-taxonomies/hierarchical-term-selector.js.map +1 -1
  92. package/build-module/components/post-taxonomies/most-used-terms.js +1 -7
  93. package/build-module/components/post-taxonomies/most-used-terms.js.map +1 -1
  94. package/build-module/components/post-visibility/check.js +3 -6
  95. package/build-module/components/post-visibility/check.js.map +1 -1
  96. package/build-module/components/provider/use-block-editor-settings.js +1 -1
  97. package/build-module/components/provider/use-block-editor-settings.js.map +1 -1
  98. package/build-module/components/theme-support-check/index.js +3 -6
  99. package/build-module/components/theme-support-check/index.js.map +1 -1
  100. package/build-module/store/utils/notice-builder.js +4 -7
  101. package/build-module/store/utils/notice-builder.js.map +1 -1
  102. package/build-style/style-rtl.css +1 -1
  103. package/build-style/style.css +1 -1
  104. package/package.json +30 -30
  105. package/src/components/autosave-monitor/test/index.js +4 -4
  106. package/src/components/document-outline/index.js +6 -3
  107. package/src/components/editor-help/index.native.js +21 -14
  108. package/src/components/media-categories/index.js +1 -1
  109. package/src/components/page-attributes/check.js +3 -12
  110. package/src/components/page-attributes/parent.js +41 -41
  111. package/src/components/post-author/check.js +2 -10
  112. package/src/components/post-featured-image/index.js +5 -10
  113. package/src/components/post-locked-modal/index.js +1 -6
  114. package/src/components/post-pending-status/check.js +2 -10
  115. package/src/components/post-preview-button/index.js +1 -2
  116. package/src/components/post-publish-button/index.js +3 -7
  117. package/src/components/post-publish-button/label.js +2 -10
  118. package/src/components/post-publish-panel/index.js +3 -11
  119. package/src/components/post-publish-panel/maybe-post-format-panel.js +2 -10
  120. package/src/components/post-publish-panel/postpublish.js +3 -8
  121. package/src/components/post-publish-panel/prepublish.js +2 -10
  122. package/src/components/post-publish-panel/style.scss +1 -1
  123. package/src/components/post-schedule/check.js +2 -10
  124. package/src/components/post-sticky/check.js +1 -10
  125. package/src/components/post-taxonomies/flat-term-selector.js +14 -32
  126. package/src/components/post-taxonomies/hierarchical-term-selector.js +15 -37
  127. package/src/components/post-taxonomies/most-used-terms.js +1 -7
  128. package/src/components/post-text-editor/test/index.js +0 -2
  129. package/src/components/post-visibility/check.js +2 -10
  130. package/src/components/provider/use-block-editor-settings.js +1 -0
  131. package/src/components/theme-support-check/index.js +1 -6
  132. package/src/store/test/actions.js +0 -2
  133. package/src/store/utils/notice-builder.js +2 -7
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -180,27 +175,18 @@ export function HierarchicalTermSelector( { slug } ) {
180
175
  const { getTaxonomy, getEntityRecords, isResolving } =
181
176
  select( coreStore );
182
177
  const _taxonomy = getTaxonomy( slug );
178
+ const post = getCurrentPost();
183
179
 
184
180
  return {
185
181
  hasCreateAction: _taxonomy
186
- ? get(
187
- getCurrentPost(),
188
- [
189
- '_links',
190
- 'wp:action-create-' + _taxonomy.rest_base,
191
- ],
192
- false
193
- )
182
+ ? post._links?.[
183
+ 'wp:action-create-' + _taxonomy.rest_base
184
+ ] ?? false
194
185
  : false,
195
186
  hasAssignAction: _taxonomy
196
- ? get(
197
- getCurrentPost(),
198
- [
199
- '_links',
200
- 'wp:action-assign-' + _taxonomy.rest_base,
201
- ],
202
- false
203
- )
187
+ ? post._links?.[
188
+ 'wp:action-assign-' + _taxonomy.rest_base
189
+ ] ?? false
204
190
  : false,
205
191
  terms: _taxonomy
206
192
  ? getEditedPostAttribute( _taxonomy.rest_base )
@@ -308,14 +294,12 @@ export function HierarchicalTermSelector( { slug } ) {
308
294
  parent: formParent ? formParent : undefined,
309
295
  } );
310
296
 
297
+ const defaultName =
298
+ slug === 'category' ? __( 'Category' ) : __( 'Term' );
311
299
  const termAddedMessage = sprintf(
312
300
  /* translators: %s: taxonomy name */
313
301
  _x( '%s added', 'term' ),
314
- get(
315
- taxonomy,
316
- [ 'labels', 'singular_name' ],
317
- slug === 'category' ? __( 'Category' ) : __( 'Term' )
318
- )
302
+ taxonomy?.labels?.singular_name ?? defaultName
319
303
  );
320
304
  speak( termAddedMessage, 'assertive' );
321
305
  setAdding( false );
@@ -383,11 +367,9 @@ export function HierarchicalTermSelector( { slug } ) {
383
367
  fallbackIsCategory,
384
368
  fallbackIsNotCategory
385
369
  ) =>
386
- get(
387
- taxonomy,
388
- [ 'labels', labelProperty ],
389
- slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory
390
- );
370
+ taxonomy?.labels?.[ labelProperty ] ??
371
+ ( slug === 'category' ? fallbackIsCategory : fallbackIsNotCategory );
372
+
391
373
  const newTermButtonLabel = labelWithFallback(
392
374
  'add_new_item',
393
375
  __( 'Add new category' ),
@@ -405,12 +387,8 @@ export function HierarchicalTermSelector( { slug } ) {
405
387
  );
406
388
  const noParentOption = `— ${ parentSelectLabel } —`;
407
389
  const newTermSubmitLabel = newTermButtonLabel;
408
- const filterLabel = get(
409
- taxonomy,
410
- [ 'labels', 'search_items' ],
411
- __( 'Search Terms' )
412
- );
413
- const groupLabel = get( taxonomy, [ 'name' ], __( 'Terms' ) );
390
+ const filterLabel = taxonomy?.labels?.search_items ?? __( 'Search Terms' );
391
+ const groupLabel = taxonomy?.name ?? __( 'Terms' );
414
392
  const showFilter = availableTerms.length >= MIN_TERMS_COUNT_FOR_FILTER;
415
393
 
416
394
  return (
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -46,7 +41,6 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
46
41
  }
47
42
 
48
43
  const terms = unescapeTerms( _terms );
49
- const label = get( taxonomy, [ 'labels', 'most_used' ] );
50
44
 
51
45
  return (
52
46
  <div className="editor-post-taxonomies__flat-term-most-used">
@@ -54,7 +48,7 @@ export default function MostUsedTerms( { onSelect, taxonomy } ) {
54
48
  as="h3"
55
49
  className="editor-post-taxonomies__flat-term-most-used-label"
56
50
  >
57
- { label }
51
+ { taxonomy.labels.most_used }
58
52
  </BaseControl.VisualLabel>
59
53
  { /*
60
54
  * Disable reason: The `list` ARIA role is redundant but
@@ -38,8 +38,6 @@ jest.mock( '@wordpress/data/src/components/use-dispatch', () => {
38
38
  };
39
39
  } );
40
40
 
41
- jest.useRealTimers();
42
-
43
41
  describe( 'PostTextEditor', () => {
44
42
  beforeEach( () => {
45
43
  useSelect.mockImplementation( () => 'Hello World' );
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -23,11 +18,8 @@ export default compose( [
23
18
  withSelect( ( select ) => {
24
19
  const { getCurrentPost, getCurrentPostType } = select( editorStore );
25
20
  return {
26
- hasPublishAction: get(
27
- getCurrentPost(),
28
- [ '_links', 'wp:action-publish' ],
29
- false
30
- ),
21
+ hasPublishAction:
22
+ getCurrentPost()._links?.[ 'wp:action-publish' ] ?? false,
31
23
  postType: getCurrentPostType(),
32
24
  };
33
25
  } ),
@@ -62,6 +62,7 @@ const BLOCK_EDITOR_SETTINGS = [
62
62
  'locale',
63
63
  'maxWidth',
64
64
  'onUpdateDefaultBlockStyles',
65
+ 'postContentAttributes',
65
66
  'postsPerPage',
66
67
  'readOnly',
67
68
  'styles',
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { get } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -23,7 +18,7 @@ export function ThemeSupportCheck( {
23
18
  const isSupported = (
24
19
  Array.isArray( supportKeys ) ? supportKeys : [ supportKeys ]
25
20
  ).some( ( key ) => {
26
- const supported = get( themeSupports, [ key ], false );
21
+ const supported = themeSupports?.[ key ] ?? false;
27
22
  // 'post-thumbnails' can be boolean or an array of post types.
28
23
  // In the latter case, we need to verify `postType` exists
29
24
  // within `supported`. If `postType` isn't passed, then the check
@@ -15,8 +15,6 @@ import { store as preferencesStore } from '@wordpress/preferences';
15
15
  import * as actions from '../actions';
16
16
  import { store as editorStore } from '..';
17
17
 
18
- jest.useRealTimers();
19
-
20
18
  const postId = 44;
21
19
 
22
20
  const postTypeConfig = {
@@ -8,11 +8,6 @@ import { __ } from '@wordpress/i18n';
8
8
  */
9
9
  import { SAVE_POST_NOTICE_ID, TRASH_POST_NOTICE_ID } from '../constants';
10
10
 
11
- /**
12
- * External dependencies
13
- */
14
- import { get } from 'lodash';
15
-
16
11
  /**
17
12
  * Builds the arguments for a success notification dispatch.
18
13
  *
@@ -24,7 +19,7 @@ import { get } from 'lodash';
24
19
  export function getNotificationArgumentsForSaveSuccess( data ) {
25
20
  const { previousPost, post, postType } = data;
26
21
  // Autosaves are neither shown a notice nor redirected.
27
- if ( get( data.options, [ 'isAutosave' ] ) ) {
22
+ if ( data.options?.isAutosave ) {
28
23
  return [];
29
24
  }
30
25
 
@@ -38,7 +33,7 @@ export function getNotificationArgumentsForSaveSuccess( data ) {
38
33
  const willPublish = publishStatus.includes( post.status );
39
34
 
40
35
  let noticeMessage;
41
- let shouldShowLink = get( postType, [ 'viewable' ], false );
36
+ let shouldShowLink = postType?.viewable ?? false;
42
37
  let isDraft;
43
38
 
44
39
  // Always should a notice, which will be spoken for accessibility.