@wordpress/block-library 8.3.1 → 8.3.3

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 (51) hide show
  1. package/build/cover/edit/index.js +3 -2
  2. package/build/cover/edit/index.js.map +1 -1
  3. package/build/image/image.js +10 -5
  4. package/build/image/image.js.map +1 -1
  5. package/build/navigation/edit/index.js +2 -28
  6. package/build/navigation/edit/index.js.map +1 -1
  7. package/build/navigation/edit/menu-inspector-controls.js +2 -2
  8. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  9. package/build/navigation/edit/unsaved-inner-blocks.js +4 -5
  10. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  11. package/build/navigation/edit/use-create-navigation-menu.js +11 -2
  12. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  13. package/build/{experiments.js → private-apis.js} +3 -3
  14. package/build/private-apis.js.map +1 -0
  15. package/build-module/cover/edit/index.js +3 -2
  16. package/build-module/cover/edit/index.js.map +1 -1
  17. package/build-module/image/image.js +10 -5
  18. package/build-module/image/image.js.map +1 -1
  19. package/build-module/navigation/edit/index.js +3 -29
  20. package/build-module/navigation/edit/index.js.map +1 -1
  21. package/build-module/navigation/edit/menu-inspector-controls.js +3 -3
  22. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  23. package/build-module/navigation/edit/unsaved-inner-blocks.js +4 -5
  24. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  25. package/build-module/navigation/edit/use-create-navigation-menu.js +11 -2
  26. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  27. package/build-module/{experiments.js → private-apis.js} +2 -2
  28. package/build-module/private-apis.js.map +1 -0
  29. package/build-style/classic-rtl.css +5 -0
  30. package/build-style/classic.css +5 -0
  31. package/build-style/editor-rtl.css +4 -1
  32. package/build-style/editor.css +4 -1
  33. package/package.json +16 -16
  34. package/src/classic.scss +5 -0
  35. package/src/cover/edit/index.js +4 -1
  36. package/src/editor.scss +5 -0
  37. package/src/gallery/index.php +7 -6
  38. package/src/image/image.js +36 -25
  39. package/src/navigation/edit/index.js +1 -30
  40. package/src/navigation/edit/menu-inspector-controls.js +4 -3
  41. package/src/navigation/edit/unsaved-inner-blocks.js +29 -36
  42. package/src/navigation/edit/use-create-navigation-menu.js +13 -1
  43. package/src/navigation/index.php +48 -80
  44. package/src/navigation-link/index.php +0 -32
  45. package/src/navigation-submenu/index.php +0 -32
  46. package/src/{experiments.js → private-apis.js} +1 -1
  47. package/src/read-more/index.php +10 -3
  48. package/tsconfig.json +24 -1
  49. package/tsconfig.tsbuildinfo +1 -1
  50. package/build/experiments.js.map +0 -1
  51. package/build-module/experiments.js.map +0 -1
package/src/classic.scss CHANGED
@@ -13,3 +13,8 @@
13
13
 
14
14
  font-size: 1.125em;
15
15
  }
16
+
17
+ .wp-block-file__button {
18
+ background: #32373c;
19
+ color: $white;
20
+ }
@@ -116,7 +116,10 @@ function CoverEdit( {
116
116
  // we define the url and background type
117
117
  // depending on the value of the useFeaturedImage flag
118
118
  // to preview in edit the dynamic featured image
119
- const url = useFeaturedImage ? mediaUrl : attributes.url;
119
+ const url = useFeaturedImage
120
+ ? mediaUrl
121
+ : // Ensure the url is not malformed due to sanitization through `wp_kses`.
122
+ attributes.url?.replaceAll( '&', '&' );
120
123
  const backgroundType = useFeaturedImage
121
124
  ? IMAGE_BACKGROUND_TYPE
122
125
  : attributes.backgroundType;
package/src/editor.scss CHANGED
@@ -93,3 +93,8 @@
93
93
  * These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper.
94
94
  * This allows us to create normalization styles that are easily overridden by editor styles.
95
95
  */
96
+
97
+ // Remove the browser default border for iframe in Custom HTML block, Embed block, etc.
98
+ .editor-styles-wrapper iframe:not([frameborder]) {
99
+ border: 0;
100
+ }
@@ -99,12 +99,13 @@ function block_core_gallery_render( $attributes, $content ) {
99
99
  }
100
100
 
101
101
  // Set the CSS variable to the column value, and the `gap` property to the combined gap value.
102
- $gallery_styles = array();
103
- $gallery_styles[] = array(
104
- 'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
105
- 'declarations' => array(
106
- '--wp--style--unstable-gallery-gap' => $gap_column,
107
- 'gap' => $gap_value,
102
+ $gallery_styles = array(
103
+ array(
104
+ 'selector' => ".wp-block-gallery.{$unique_gallery_classname}",
105
+ 'declarations' => array(
106
+ '--wp--style--unstable-gallery-gap' => $gap_column,
107
+ 'gap' => $gap_value,
108
+ ),
108
109
  ),
109
110
  );
110
111
 
@@ -124,30 +124,37 @@ export default function Image( {
124
124
  },
125
125
  [ id, isSelected, clientId ]
126
126
  );
127
- const { canInsertCover, imageEditing, imageSizes, mediaUpload } = useSelect(
128
- ( select ) => {
129
- const { getBlockRootClientId, getSettings, canInsertBlockType } =
130
- select( blockEditorStore );
131
-
132
- const rootClientId = getBlockRootClientId( clientId );
133
- const settings = Object.fromEntries(
134
- Object.entries( getSettings() ).filter( ( [ key ] ) =>
135
- [ 'imageEditing', 'imageSizes', 'mediaUpload' ].includes(
136
- key
127
+ const { canInsertCover, imageEditing, imageSizes, maxWidth, mediaUpload } =
128
+ useSelect(
129
+ ( select ) => {
130
+ const {
131
+ getBlockRootClientId,
132
+ getSettings,
133
+ canInsertBlockType,
134
+ } = select( blockEditorStore );
135
+
136
+ const rootClientId = getBlockRootClientId( clientId );
137
+ const settings = Object.fromEntries(
138
+ Object.entries( getSettings() ).filter( ( [ key ] ) =>
139
+ [
140
+ 'imageEditing',
141
+ 'imageSizes',
142
+ 'maxWidth',
143
+ 'mediaUpload',
144
+ ].includes( key )
137
145
  )
138
- )
139
- );
146
+ );
140
147
 
141
- return {
142
- ...settings,
143
- canInsertCover: canInsertBlockType(
144
- 'core/cover',
145
- rootClientId
146
- ),
147
- };
148
- },
149
- [ clientId ]
150
- );
148
+ return {
149
+ ...settings,
150
+ canInsertCover: canInsertBlockType(
151
+ 'core/cover',
152
+ rootClientId
153
+ ),
154
+ };
155
+ },
156
+ [ clientId ]
157
+ );
151
158
  const { replaceBlocks, toggleSelection } = useDispatch( blockEditorStore );
152
159
  const { createErrorNotice, createSuccessNotice } =
153
160
  useDispatch( noticesStore );
@@ -548,9 +555,13 @@ export default function Image( {
548
555
  // With the current implementation of ResizableBox, an image needs an
549
556
  // explicit pixel value for the max-width. In absence of being able to
550
557
  // set the content-width, this max-width is currently dictated by the
551
- // vanilla editor style. We'll use the clientWidth here, to prevent the width
552
- // of the image growing larger than the width of the block column.
553
- const maxWidthBuffer = clientWidth;
558
+ // vanilla editor style. The following variable adds a buffer to this
559
+ // vanilla style, so 3rd party themes have some wiggleroom. This does,
560
+ // in most cases, allow you to scale the image beyond the width of the
561
+ // main column, though not infinitely.
562
+ // @todo It would be good to revisit this once a content-width variable
563
+ // becomes available.
564
+ const maxWidthBuffer = maxWidth * 2.5;
554
565
 
555
566
  let showRightHandle = false;
556
567
  let showLeftHandle = false;
@@ -27,7 +27,7 @@ import {
27
27
  __experimentalUseBlockOverlayActive as useBlockOverlayActive,
28
28
  __experimentalUseMultipleOriginColorsAndGradients as useMultipleOriginColorsAndGradients,
29
29
  } from '@wordpress/block-editor';
30
- import { EntityProvider, store as coreStore } from '@wordpress/core-data';
30
+ import { EntityProvider } from '@wordpress/core-data';
31
31
 
32
32
  import { useDispatch } from '@wordpress/data';
33
33
  import {
@@ -112,7 +112,6 @@ function Navigation( {
112
112
 
113
113
  const recursionId = `navigationMenu/${ ref }`;
114
114
  const hasAlreadyRendered = useHasRecursion( recursionId );
115
- const { editEntityRecord } = useDispatch( coreStore );
116
115
 
117
116
  // Preload classic menus, so that they don't suddenly pop-in when viewing
118
117
  // the Select Menu dropdown.
@@ -128,11 +127,6 @@ function Navigation( {
128
127
  name: 'block-library/core/navigation/classic-menu-conversion',
129
128
  } );
130
129
 
131
- const [ showMenuAutoPublishDraftNotice, hideMenuAutoPublishDraftNotice ] =
132
- useNavigationNotice( {
133
- name: 'block-library/core/navigation/auto-publish-draft',
134
- } );
135
-
136
130
  const [
137
131
  showNavigationMenuPermissionsNotice,
138
132
  hideNavigationMenuPermissionsNotice,
@@ -209,7 +203,6 @@ function Navigation( {
209
203
  isNavigationMenuResolved,
210
204
  isNavigationMenuMissing,
211
205
  navigationMenus,
212
- navigationMenu,
213
206
  canUserUpdateNavigationMenu,
214
207
  hasResolvedCanUserUpdateNavigationMenu,
215
208
  canUserDeleteNavigationMenu,
@@ -536,26 +529,6 @@ function Navigation( {
536
529
  { open: overlayMenuPreview }
537
530
  );
538
531
 
539
- // Prompt the user to publish the menu they have set as a draft
540
- const isDraftNavigationMenu = navigationMenu?.status === 'draft';
541
- useEffect( () => {
542
- hideMenuAutoPublishDraftNotice();
543
- if ( ! isDraftNavigationMenu ) {
544
- return;
545
- }
546
- editEntityRecord(
547
- 'postType',
548
- 'wp_navigation',
549
- navigationMenu?.id,
550
- { status: 'publish' },
551
- { throwOnError: true }
552
- ).catch( () => {
553
- showMenuAutoPublishDraftNotice(
554
- __( 'Error occurred while publishing the navigation menu.' )
555
- );
556
- } );
557
- }, [ isDraftNavigationMenu, navigationMenu ] );
558
-
559
532
  const colorGradientSettings = useMultipleOriginColorsAndGradients();
560
533
  const stylingInspectorControls = (
561
534
  <>
@@ -752,8 +725,6 @@ function Navigation( {
752
725
  <UnsavedInnerBlocks
753
726
  createNavigationMenu={ createNavigationMenu }
754
727
  blocks={ uncontrolledInnerBlocks }
755
- templateLock={ templateLock }
756
- navigationMenus={ navigationMenus }
757
728
  hasSelection={ isSelected || isInnerBlockSelected }
758
729
  />
759
730
  </ResponsiveWrapper>
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import {
5
- experiments as blockEditorExperiments,
5
+ privateApis as blockEditorPrivateApis,
6
6
  InspectorControls,
7
7
  store as blockEditorStore,
8
8
  } from '@wordpress/block-editor';
@@ -20,7 +20,7 @@ import { __, sprintf } from '@wordpress/i18n';
20
20
  */
21
21
  import NavigationMenuSelector from './navigation-menu-selector';
22
22
  import { LeafMoreMenu } from '../leaf-more-menu';
23
- import { unlock } from '../../experiments';
23
+ import { unlock } from '../../private-apis';
24
24
  import DeletedNavigationWarning from './deleted-navigation-warning';
25
25
  import useNavigationMenu from '../use-navigation-menu';
26
26
 
@@ -34,7 +34,8 @@ const MainContent = ( {
34
34
  isNavigationMenuMissing,
35
35
  onCreateNew,
36
36
  } ) => {
37
- const { OffCanvasEditor } = unlock( blockEditorExperiments );
37
+ const { OffCanvasEditor } = unlock( blockEditorPrivateApis );
38
+
38
39
  // Provide a hierarchy of clientIds for the given Navigation block (clientId).
39
40
  // This is required else the list view will display the entire block tree.
40
41
  const clientIdsTree = useSelect(
@@ -39,7 +39,6 @@ const ALLOWED_BLOCKS = [
39
39
  export default function UnsavedInnerBlocks( {
40
40
  blocks,
41
41
  createNavigationMenu,
42
-
43
42
  hasSelection,
44
43
  } ) {
45
44
  const originalBlocks = useRef();
@@ -91,37 +90,34 @@ export default function UnsavedInnerBlocks( {
91
90
  }
92
91
  );
93
92
 
94
- const { isSaving, draftNavigationMenus, hasResolvedDraftNavigationMenus } =
95
- useSelect(
96
- ( select ) => {
97
- if ( isDisabled ) {
98
- return EMPTY_OBJECT;
99
- }
100
-
101
- const {
102
- getEntityRecords,
103
- hasFinishedResolution,
104
- isSavingEntityRecord,
105
- } = select( coreStore );
106
-
107
- return {
108
- isSaving: isSavingEntityRecord(
109
- 'postType',
110
- 'wp_navigation'
111
- ),
112
- draftNavigationMenus: getEntityRecords(
113
- ...DRAFT_MENU_PARAMS
114
- ),
115
- hasResolvedDraftNavigationMenus: hasFinishedResolution(
116
- 'getEntityRecords',
117
- DRAFT_MENU_PARAMS
118
- ),
119
- };
120
- },
121
- [ isDisabled ]
122
- );
123
-
124
- const { hasResolvedNavigationMenus, navigationMenus } = useNavigationMenu();
93
+ const { isSaving, hasResolvedDraftNavigationMenus } = useSelect(
94
+ ( select ) => {
95
+ if ( isDisabled ) {
96
+ return EMPTY_OBJECT;
97
+ }
98
+
99
+ const {
100
+ getEntityRecords,
101
+ hasFinishedResolution,
102
+ isSavingEntityRecord,
103
+ } = select( coreStore );
104
+
105
+ return {
106
+ isSaving: isSavingEntityRecord( 'postType', 'wp_navigation' ),
107
+ draftNavigationMenus: getEntityRecords(
108
+ // This is needed so that hasResolvedDraftNavigationMenus gives the correct status.
109
+ ...DRAFT_MENU_PARAMS
110
+ ),
111
+ hasResolvedDraftNavigationMenus: hasFinishedResolution(
112
+ 'getEntityRecords',
113
+ DRAFT_MENU_PARAMS
114
+ ),
115
+ };
116
+ },
117
+ [ isDisabled ]
118
+ );
119
+
120
+ const { hasResolvedNavigationMenus } = useNavigationMenu();
125
121
 
126
122
  // Automatically save the uncontrolled blocks.
127
123
  useEffect( () => {
@@ -154,11 +150,8 @@ export default function UnsavedInnerBlocks( {
154
150
  isSaving,
155
151
  hasResolvedDraftNavigationMenus,
156
152
  hasResolvedNavigationMenus,
157
- draftNavigationMenus,
158
- navigationMenus,
153
+ innerBlocksAreDirty,
159
154
  hasSelection,
160
- createNavigationMenu,
161
- blocks,
162
155
  ] );
163
156
 
164
157
  const Wrapper = isSaving ? Disabled : 'div';
@@ -21,7 +21,7 @@ export default function useCreateNavigationMenu( clientId ) {
21
21
  const [ value, setValue ] = useState( null );
22
22
  const [ error, setError ] = useState( null );
23
23
 
24
- const { saveEntityRecord } = useDispatch( coreStore );
24
+ const { saveEntityRecord, editEntityRecord } = useDispatch( coreStore );
25
25
  const generateDefaultTitle = useGenerateDefaultNavigationTitle( clientId );
26
26
 
27
27
  // This callback uses data from the two placeholder steps and only creates
@@ -68,6 +68,18 @@ export default function useCreateNavigationMenu( clientId ) {
68
68
  .then( ( response ) => {
69
69
  setValue( response );
70
70
  setStatus( CREATE_NAVIGATION_MENU_SUCCESS );
71
+
72
+ // Set the status to publish so that the Navigation block
73
+ // shows up in the multi entity save flow.
74
+ if ( postStatus !== 'publish' ) {
75
+ editEntityRecord(
76
+ 'postType',
77
+ 'wp_navigation',
78
+ response.id,
79
+ { status: 'publish' }
80
+ );
81
+ }
82
+
71
83
  return response;
72
84
  } )
73
85
  .catch( ( err ) => {
@@ -65,58 +65,58 @@ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
65
65
 
66
66
  return $menu_items_by_parent_id;
67
67
  }
68
+ }
68
69
 
69
- /**
70
- * Turns menu item data into a nested array of parsed blocks
71
- *
72
- * @param array $menu_items An array of menu items that represent
73
- * an individual level of a menu.
74
- * @param array $menu_items_by_parent_id An array keyed by the id of the
75
- * parent menu where each element is an
76
- * array of menu items that belong to
77
- * that parent.
78
- * @return array An array of parsed block data.
79
- */
80
- function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
81
- if ( empty( $menu_items ) ) {
82
- return array();
83
- }
70
+ /**
71
+ * Turns menu item data into a nested array of parsed blocks
72
+ *
73
+ * @param array $menu_items An array of menu items that represent
74
+ * an individual level of a menu.
75
+ * @param array $menu_items_by_parent_id An array keyed by the id of the
76
+ * parent menu where each element is an
77
+ * array of menu items that belong to
78
+ * that parent.
79
+ * @return array An array of parsed block data.
80
+ */
81
+ function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
82
+ if ( empty( $menu_items ) ) {
83
+ return array();
84
+ }
85
+
86
+ $blocks = array();
87
+
88
+ foreach ( $menu_items as $menu_item ) {
89
+ $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
90
+ $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
91
+ $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
92
+ $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
93
+ $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
94
+
95
+ $block = array(
96
+ 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
97
+ 'attrs' => array(
98
+ 'className' => $class_name,
99
+ 'description' => $menu_item->description,
100
+ 'id' => $id,
101
+ 'kind' => $kind,
102
+ 'label' => $menu_item->title,
103
+ 'opensInNewTab' => $opens_in_new_tab,
104
+ 'rel' => $rel,
105
+ 'title' => $menu_item->attr_title,
106
+ 'type' => $menu_item->object,
107
+ 'url' => $menu_item->url,
108
+ ),
109
+ );
84
110
 
85
- $blocks = array();
86
-
87
- foreach ( $menu_items as $menu_item ) {
88
- $class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
89
- $id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
90
- $opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
91
- $rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
92
- $kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
93
-
94
- $block = array(
95
- 'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
96
- 'attrs' => array(
97
- 'className' => $class_name,
98
- 'description' => $menu_item->description,
99
- 'id' => $id,
100
- 'kind' => $kind,
101
- 'label' => $menu_item->title,
102
- 'opensInNewTab' => $opens_in_new_tab,
103
- 'rel' => $rel,
104
- 'title' => $menu_item->attr_title,
105
- 'type' => $menu_item->object,
106
- 'url' => $menu_item->url,
107
- ),
108
- );
109
-
110
- $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
111
- ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
112
- : array();
113
- $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
114
-
115
- $blocks[] = $block;
116
- }
111
+ $block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
112
+ ? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
113
+ : array();
114
+ $block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
117
115
 
118
- return $blocks;
116
+ $blocks[] = $block;
119
117
  }
118
+
119
+ return $blocks;
120
120
  }
121
121
 
122
122
  /**
@@ -874,35 +874,3 @@ function block_core_navigation_typographic_presets_backcompatibility( $parsed_bl
874
874
  }
875
875
 
876
876
  add_filter( 'render_block_data', 'block_core_navigation_typographic_presets_backcompatibility' );
877
-
878
- /**
879
- * Enables animation of the block inspector for the Navigation block.
880
- *
881
- * See:
882
- * - https://github.com/WordPress/gutenberg/pull/46342
883
- * - https://github.com/WordPress/gutenberg/issues/45884
884
- *
885
- * @param array $settings Default editor settings.
886
- * @return array Filtered editor settings.
887
- */
888
- function block_core_navigation_enable_inspector_animation( $settings ) {
889
- $current_animation_settings = _wp_array_get(
890
- $settings,
891
- array( '__experimentalBlockInspectorAnimation' ),
892
- array()
893
- );
894
-
895
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
896
- $current_animation_settings,
897
- array(
898
- 'core/navigation' =>
899
- array(
900
- 'enterDirection' => 'leftToRight',
901
- ),
902
- )
903
- );
904
-
905
- return $settings;
906
- }
907
-
908
- add_filter( 'block_editor_settings_all', 'block_core_navigation_enable_inspector_animation' );
@@ -371,35 +371,3 @@ function register_block_core_navigation_link() {
371
371
  );
372
372
  }
373
373
  add_action( 'init', 'register_block_core_navigation_link' );
374
-
375
- /**
376
- * Enables animation of the block inspector for the Navigation Link block.
377
- *
378
- * See:
379
- * - https://github.com/WordPress/gutenberg/pull/46342
380
- * - https://github.com/WordPress/gutenberg/issues/45884
381
- *
382
- * @param array $settings Default editor settings.
383
- * @return array Filtered editor settings.
384
- */
385
- function block_core_navigation_link_enable_inspector_animation( $settings ) {
386
- $current_animation_settings = _wp_array_get(
387
- $settings,
388
- array( '__experimentalBlockInspectorAnimation' ),
389
- array()
390
- );
391
-
392
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
393
- $current_animation_settings,
394
- array(
395
- 'core/navigation-link' =>
396
- array(
397
- 'enterDirection' => 'rightToLeft',
398
- ),
399
- )
400
- );
401
-
402
- return $settings;
403
- }
404
-
405
- add_filter( 'block_editor_settings_all', 'block_core_navigation_link_enable_inspector_animation' );
@@ -289,35 +289,3 @@ function register_block_core_navigation_submenu() {
289
289
  );
290
290
  }
291
291
  add_action( 'init', 'register_block_core_navigation_submenu' );
292
-
293
- /**
294
- * Enables animation of the block inspector for the Navigation Submenu block.
295
- *
296
- * See:
297
- * - https://github.com/WordPress/gutenberg/pull/46342
298
- * - https://github.com/WordPress/gutenberg/issues/45884
299
- *
300
- * @param array $settings Default editor settings.
301
- * @return array Filtered editor settings.
302
- */
303
- function block_core_navigation_submenu_enable_inspector_animation( $settings ) {
304
- $current_animation_settings = _wp_array_get(
305
- $settings,
306
- array( '__experimentalBlockInspectorAnimation' ),
307
- array()
308
- );
309
-
310
- $settings['__experimentalBlockInspectorAnimation'] = array_merge(
311
- $current_animation_settings,
312
- array(
313
- 'core/navigation-submenu' =>
314
- array(
315
- 'enterDirection' => 'rightToLeft',
316
- ),
317
- )
318
- );
319
-
320
- return $settings;
321
- }
322
-
323
- add_filter( 'block_editor_settings_all', 'block_core_navigation_submenu_enable_inspector_animation' );
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/experiments';
4
+ import { __dangerousOptInToUnstableAPIsOnlyForCoreModules } from '@wordpress/private-apis';
5
5
 
6
6
  export const { lock, unlock } =
7
7
  __dangerousOptInToUnstableAPIsOnlyForCoreModules(
@@ -18,12 +18,19 @@ function render_block_core_read_more( $attributes, $content, $block ) {
18
18
  return '';
19
19
  }
20
20
 
21
- $post_ID = $block->context['postId'];
22
- $post_title = get_the_title( $post_ID );
21
+ $post_ID = $block->context['postId'];
22
+ $post_title = get_the_title( $post_ID );
23
+ if ( '' === $post_title ) {
24
+ $post_title = sprintf(
25
+ /* translators: %s is post ID to describe the link for screen readers. */
26
+ __( 'untitled post %s' ),
27
+ $post_ID
28
+ );
29
+ }
23
30
  $screen_reader_text = sprintf(
24
31
  /* translators: %s is either the post title or post ID to describe the link for screen readers. */
25
32
  __( ': %s' ),
26
- '' !== $post_title ? $post_title : __( 'untitled post ' ) . $post_ID
33
+ $post_title
27
34
  );
28
35
  $justify_class_name = empty( $attributes['justifyContent'] ) ? '' : "is-justified-{$attributes['justifyContent']}";
29
36
  $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $justify_class_name ) );
package/tsconfig.json CHANGED
@@ -6,6 +6,29 @@
6
6
  "types": [ "gutenberg-env" ],
7
7
  "strictNullChecks": true
8
8
  },
9
- "references": [ { "path": "../element" } ],
9
+ "references": [
10
+ { "path": "../a11y" },
11
+ { "path": "../api-fetch" },
12
+ { "path": "../autop" },
13
+ { "path": "../blob" },
14
+ { "path": "../block-editor" },
15
+ { "path": "../components" },
16
+ { "path": "../compose" },
17
+ { "path": "../core-data" },
18
+ { "path": "../data" },
19
+ { "path": "../date" },
20
+ { "path": "../deprecated" },
21
+ { "path": "../dom" },
22
+ { "path": "../element" },
23
+ { "path": "../escape-html" },
24
+ { "path": "../private-apis" },
25
+ { "path": "../hooks" },
26
+ { "path": "../html-entities" },
27
+ { "path": "../i18n" },
28
+ { "path": "../icons" },
29
+ { "path": "../keycodes" },
30
+ { "path": "../primitives" },
31
+ { "path": "../url" }
32
+ ],
10
33
  "include": [ "src/**/*.ts", "src/**/*.tsx" ]
11
34
  }