@wordpress/block-library 9.41.0 → 9.41.1-next.v.202603161435.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 (199) hide show
  1. package/build/cover/edit/cover-placeholder.cjs +7 -0
  2. package/build/cover/edit/cover-placeholder.cjs.map +2 -2
  3. package/build/html/block.json +2 -1
  4. package/build/html/modal.cjs +142 -147
  5. package/build/html/modal.cjs.map +3 -3
  6. package/build/icon/block.json +3 -12
  7. package/build/image/edit.cjs +7 -0
  8. package/build/image/edit.cjs.map +2 -2
  9. package/build/image/image.cjs +5 -9
  10. package/build/image/image.cjs.map +2 -2
  11. package/build/media-text/media-container.cjs +6 -0
  12. package/build/media-text/media-container.cjs.map +2 -2
  13. package/build/navigation/edit/index.cjs +21 -14
  14. package/build/navigation/edit/index.cjs.map +3 -3
  15. package/build/navigation/view.cjs +9 -2
  16. package/build/navigation/view.cjs.map +2 -2
  17. package/build/navigation-link/block.json +5 -0
  18. package/build/navigation-link/shared/use-link-preview.cjs +29 -0
  19. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  20. package/build/nextpage/block.json +0 -1
  21. package/build/paragraph/edit.cjs +1 -1
  22. package/build/paragraph/edit.cjs.map +1 -1
  23. package/build/playlist/edit.cjs +3 -23
  24. package/build/playlist/edit.cjs.map +3 -3
  25. package/build/playlist/utils.cjs +48 -0
  26. package/build/playlist/utils.cjs.map +7 -0
  27. package/build/playlist-track/block.json +0 -0
  28. package/build/post-excerpt/block.json +1 -3
  29. package/build/post-excerpt/deprecated.cjs +112 -0
  30. package/build/post-excerpt/deprecated.cjs.map +7 -0
  31. package/build/post-excerpt/edit.cjs +11 -30
  32. package/build/post-excerpt/edit.cjs.map +3 -3
  33. package/build/post-excerpt/index.cjs +3 -1
  34. package/build/post-excerpt/index.cjs.map +3 -3
  35. package/build/private-apis.cjs +3 -1
  36. package/build/private-apis.cjs.map +2 -2
  37. package/build/shortcode/block.json +2 -1
  38. package/build/site-logo/edit.cjs +1 -3
  39. package/build/site-logo/edit.cjs.map +2 -2
  40. package/build/tab/add-tab-toolbar-control.cjs +22 -5
  41. package/build/tab/add-tab-toolbar-control.cjs.map +2 -2
  42. package/build/tab/remove-tab-toolbar-control.cjs +19 -1
  43. package/build/tab/remove-tab-toolbar-control.cjs.map +2 -2
  44. package/build/tabs/edit.cjs +85 -7
  45. package/build/tabs/edit.cjs.map +2 -2
  46. package/build/tabs/index.cjs +12 -2
  47. package/build/tabs/index.cjs.map +2 -2
  48. package/build/tabs-menu/block.json +1 -6
  49. package/build/tabs-menu/edit.cjs +11 -151
  50. package/build/tabs-menu/edit.cjs.map +3 -3
  51. package/build/tabs-menu/save.cjs.map +2 -2
  52. package/build/tabs-menu-item/block.json +14 -11
  53. package/build/tabs-menu-item/controls.cjs +2 -133
  54. package/build/tabs-menu-item/controls.cjs.map +3 -3
  55. package/build/tabs-menu-item/edit.cjs +44 -56
  56. package/build/tabs-menu-item/edit.cjs.map +3 -3
  57. package/build/tabs-menu-item/save.cjs +0 -1
  58. package/build/tabs-menu-item/save.cjs.map +2 -2
  59. package/build/template-part/edit/index.cjs +6 -4
  60. package/build/template-part/edit/index.cjs.map +2 -2
  61. package/build/utils/media-control.cjs +72 -29
  62. package/build/utils/media-control.cjs.map +3 -3
  63. package/build-module/cover/edit/cover-placeholder.mjs +7 -0
  64. package/build-module/cover/edit/cover-placeholder.mjs.map +2 -2
  65. package/build-module/html/block.json +2 -1
  66. package/build-module/html/modal.mjs +144 -149
  67. package/build-module/html/modal.mjs.map +2 -2
  68. package/build-module/icon/block.json +3 -12
  69. package/build-module/image/edit.mjs +7 -0
  70. package/build-module/image/edit.mjs.map +2 -2
  71. package/build-module/image/image.mjs +5 -9
  72. package/build-module/image/image.mjs.map +2 -2
  73. package/build-module/media-text/media-container.mjs +7 -1
  74. package/build-module/media-text/media-container.mjs.map +2 -2
  75. package/build-module/navigation/edit/index.mjs +22 -14
  76. package/build-module/navigation/edit/index.mjs.map +2 -2
  77. package/build-module/navigation/view.mjs +9 -2
  78. package/build-module/navigation/view.mjs.map +2 -2
  79. package/build-module/navigation-link/block.json +5 -0
  80. package/build-module/navigation-link/shared/use-link-preview.mjs +28 -0
  81. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  82. package/build-module/nextpage/block.json +0 -1
  83. package/build-module/paragraph/edit.mjs +2 -2
  84. package/build-module/paragraph/edit.mjs.map +1 -1
  85. package/build-module/playlist/edit.mjs +2 -18
  86. package/build-module/playlist/edit.mjs.map +2 -2
  87. package/build-module/playlist/utils.mjs +23 -0
  88. package/build-module/playlist/utils.mjs.map +7 -0
  89. package/build-module/playlist-track/block.json +0 -0
  90. package/build-module/post-excerpt/block.json +1 -3
  91. package/build-module/post-excerpt/deprecated.mjs +81 -0
  92. package/build-module/post-excerpt/deprecated.mjs.map +7 -0
  93. package/build-module/post-excerpt/edit.mjs +12 -34
  94. package/build-module/post-excerpt/edit.mjs.map +2 -2
  95. package/build-module/post-excerpt/index.mjs +3 -1
  96. package/build-module/post-excerpt/index.mjs.map +2 -2
  97. package/build-module/private-apis.mjs +3 -1
  98. package/build-module/private-apis.mjs.map +2 -2
  99. package/build-module/shortcode/block.json +2 -1
  100. package/build-module/site-logo/edit.mjs +1 -3
  101. package/build-module/site-logo/edit.mjs.map +2 -2
  102. package/build-module/tab/add-tab-toolbar-control.mjs +22 -5
  103. package/build-module/tab/add-tab-toolbar-control.mjs.map +2 -2
  104. package/build-module/tab/remove-tab-toolbar-control.mjs +19 -1
  105. package/build-module/tab/remove-tab-toolbar-control.mjs.map +2 -2
  106. package/build-module/tabs/edit.mjs +87 -9
  107. package/build-module/tabs/edit.mjs.map +2 -2
  108. package/build-module/tabs/index.mjs +12 -2
  109. package/build-module/tabs/index.mjs.map +2 -2
  110. package/build-module/tabs-menu/block.json +1 -6
  111. package/build-module/tabs-menu/edit.mjs +13 -162
  112. package/build-module/tabs-menu/edit.mjs.map +2 -2
  113. package/build-module/tabs-menu/save.mjs.map +2 -2
  114. package/build-module/tabs-menu-item/block.json +14 -11
  115. package/build-module/tabs-menu-item/controls.mjs +4 -143
  116. package/build-module/tabs-menu-item/controls.mjs.map +2 -2
  117. package/build-module/tabs-menu-item/edit.mjs +45 -57
  118. package/build-module/tabs-menu-item/edit.mjs.map +3 -3
  119. package/build-module/tabs-menu-item/save.mjs +0 -1
  120. package/build-module/tabs-menu-item/save.mjs.map +2 -2
  121. package/build-module/template-part/edit/index.mjs +6 -4
  122. package/build-module/template-part/edit/index.mjs.map +2 -2
  123. package/build-module/utils/media-control.mjs +73 -30
  124. package/build-module/utils/media-control.mjs.map +2 -2
  125. package/build-style/common-rtl.css +1 -0
  126. package/build-style/common.css +1 -0
  127. package/build-style/editor-rtl.css +55 -17
  128. package/build-style/editor.css +55 -17
  129. package/build-style/html/editor-rtl.css +10 -6
  130. package/build-style/html/editor.css +10 -6
  131. package/build-style/navigation/style-rtl.css +15 -1
  132. package/build-style/navigation/style.css +15 -1
  133. package/build-style/navigation-overlay-close/style-rtl.css +3 -3
  134. package/build-style/navigation-overlay-close/style.css +3 -3
  135. package/build-style/playlist/style-rtl.css +4 -0
  136. package/build-style/playlist/style.css +4 -0
  137. package/build-style/style-rtl.css +23 -4
  138. package/build-style/style.css +23 -4
  139. package/build-style/tabs-menu/editor-rtl.css +5 -3
  140. package/build-style/tabs-menu/editor.css +5 -3
  141. package/package.json +38 -38
  142. package/src/accordion-item/index.php +17 -5
  143. package/src/common.scss +1 -0
  144. package/src/cover/edit/cover-placeholder.js +8 -0
  145. package/src/cover/index.php +8 -0
  146. package/src/details/index.php +47 -0
  147. package/src/html/block.json +2 -1
  148. package/src/html/editor.scss +15 -5
  149. package/src/html/modal.js +26 -22
  150. package/src/icon/block.json +3 -12
  151. package/src/image/edit.js +8 -0
  152. package/src/image/image.js +8 -13
  153. package/src/media-text/media-container.js +8 -1
  154. package/src/navigation/edit/index.js +26 -14
  155. package/src/navigation/index.php +27 -13
  156. package/src/navigation/style.scss +17 -1
  157. package/src/navigation/view.js +14 -2
  158. package/src/navigation-link/block.json +5 -0
  159. package/src/navigation-link/index.php +10 -10
  160. package/src/navigation-link/shared/test/use-link-preview.test.js +149 -0
  161. package/src/navigation-link/shared/use-link-preview.js +43 -1
  162. package/src/navigation-overlay-close/style.scss +3 -3
  163. package/src/navigation-submenu/index.php +17 -11
  164. package/src/nextpage/block.json +0 -1
  165. package/src/paragraph/edit.js +2 -2
  166. package/src/playlist/edit.js +1 -34
  167. package/src/playlist/style.scss +5 -0
  168. package/src/playlist/test/edit.js +1 -1
  169. package/src/playlist/utils.js +42 -0
  170. package/src/playlist-track/block.json +0 -0
  171. package/src/playlist-track/edit.js +0 -0
  172. package/src/playlist-track/index.js +0 -0
  173. package/src/playlist-track/index.php +0 -0
  174. package/src/playlist-track/init.js +0 -0
  175. package/src/playlist-track/style.scss +0 -0
  176. package/src/post-excerpt/block.json +1 -3
  177. package/src/post-excerpt/deprecated.js +84 -0
  178. package/src/post-excerpt/edit.js +14 -39
  179. package/src/post-excerpt/index.js +2 -0
  180. package/src/private-apis.js +2 -0
  181. package/src/shortcode/block.json +2 -1
  182. package/src/site-logo/edit.js +1 -3
  183. package/src/tab/add-tab-toolbar-control.js +48 -23
  184. package/src/tab/remove-tab-toolbar-control.js +30 -10
  185. package/src/tabs/edit.js +133 -10
  186. package/src/tabs/index.js +12 -2
  187. package/src/tabs-menu/block.json +1 -6
  188. package/src/tabs-menu/edit.js +13 -214
  189. package/src/tabs-menu/editor.scss +7 -3
  190. package/src/tabs-menu/index.php +42 -27
  191. package/src/tabs-menu/save.js +0 -4
  192. package/src/tabs-menu-item/block.json +14 -11
  193. package/src/tabs-menu-item/controls.js +4 -167
  194. package/src/tabs-menu-item/edit.js +60 -69
  195. package/src/tabs-menu-item/index.php +11 -23
  196. package/src/tabs-menu-item/save.js +0 -1
  197. package/src/template-part/edit/index.js +5 -1
  198. package/src/utils/media-control.js +61 -21
  199. package/src/utils/media-control.scss +54 -18
@@ -26,6 +26,41 @@ function capitalize( str ) {
26
26
  return str.charAt( 0 ).toUpperCase() + str.slice( 1 );
27
27
  }
28
28
 
29
+ /**
30
+ * Check if a URL points to the site homepage.
31
+ * Handles protocol (http/https) and trailing slash variations.
32
+ * Does not match subdomains unless they are the site URL.
33
+ *
34
+ * @param {string} url - The URL to check
35
+ * @param {string} homeUrl - The WordPress site URL
36
+ * @return {boolean} True if url is the homepage
37
+ */
38
+ export function isHomepage( url, homeUrl ) {
39
+ if ( url === '/' ) {
40
+ return true;
41
+ }
42
+ if ( ! url || ! homeUrl ) {
43
+ return false;
44
+ }
45
+ try {
46
+ const urlParsed = new URL( url, homeUrl );
47
+ const homeParsed = new URL( homeUrl );
48
+
49
+ // Same host, i.e. sub.homepage.com or homepage.com
50
+ if ( urlParsed.hostname !== homeParsed.hostname ) {
51
+ return false;
52
+ }
53
+
54
+ // Path must match site root (normalize trailing slash)
55
+ const urlPath = urlParsed.pathname.replace( /\/$/, '' );
56
+ const homePath = homeParsed.pathname.replace( /\/$/, '' );
57
+
58
+ return urlPath === homePath;
59
+ } catch {
60
+ return false;
61
+ }
62
+ }
63
+
29
64
  /**
30
65
  * Compute display URL - strips site URL if internal, shows full URL if external.
31
66
  *
@@ -79,6 +114,7 @@ export function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {
79
114
  *
80
115
  * @param {Object} options - Options object
81
116
  * @param {string} options.url - Link URL
117
+ * @param {string} options.homeUrl - WordPress site URL (for homepage detection)
82
118
  * @param {string} options.type - Entity type (page, post, etc.)
83
119
  * @param {boolean} options.isExternal - Whether link is external
84
120
  * @param {string} options.entityStatus - Entity status (publish, draft, etc.)
@@ -88,6 +124,7 @@ export function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {
88
124
  */
89
125
  export function computeBadges( {
90
126
  url,
127
+ homeUrl,
91
128
  type,
92
129
  isExternal,
93
130
  entityStatus,
@@ -95,7 +132,6 @@ export function computeBadges( {
95
132
  isEntityAvailable,
96
133
  } ) {
97
134
  const badges = [];
98
-
99
135
  // Kind badge
100
136
  if ( url ) {
101
137
  if ( isExternal ) {
@@ -110,6 +146,11 @@ export function computeBadges( {
110
146
  label: __( 'Internal link' ),
111
147
  intent: 'default',
112
148
  } );
149
+ } else if ( isHomepage( url, homeUrl ) ) {
150
+ badges.push( {
151
+ label: __( 'Homepage' ),
152
+ intent: 'default',
153
+ } );
113
154
  } else if ( type && type !== 'custom' ) {
114
155
  // Show entity type badge (page, post, category, etc.)
115
156
  // but not 'custom' since that's just a manual link
@@ -226,6 +267,7 @@ export function useLinkPreview( {
226
267
  // Compute badges
227
268
  const badges = computeBadges( {
228
269
  url,
270
+ homeUrl,
229
271
  type,
230
272
  isExternal,
231
273
  entityStatus: entityRecord?.status,
@@ -3,7 +3,7 @@
3
3
  align-items: center;
4
4
  justify-content: center;
5
5
  gap: 0.5em;
6
- padding: 0.5em;
6
+ padding: 0;
7
7
  border: none;
8
8
  background: transparent;
9
9
  cursor: pointer;
@@ -14,8 +14,8 @@
14
14
  }
15
15
 
16
16
  svg {
17
- width: 1.5em;
18
- height: 1.5em;
17
+ width: 24px;
18
+ height: 24px;
19
19
  fill: currentColor;
20
20
  display: block;
21
21
  flex-shrink: 0;
@@ -5,6 +5,9 @@
5
5
  * @package WordPress
6
6
  */
7
7
 
8
+ require_once __DIR__ . '/navigation-link/shared/item-should-render.php';
9
+ require_once __DIR__ . '/navigation-link/shared/render-submenu-icon.php';
10
+
8
11
  /**
9
12
  * Returns the submenu visibility value with backward compatibility
10
13
  * for the deprecated openSubmenusOnClick attribute.
@@ -46,15 +49,6 @@ function block_core_navigation_submenu_get_submenu_visibility( $context ) {
46
49
  return $submenu_visibility ?? 'hover';
47
50
  }
48
51
 
49
- // Path differs between source and build: '../navigation-link/shared/' in source, './navigation-link/shared/' in build.
50
- if ( file_exists( __DIR__ . '/../navigation-link/shared/item-should-render.php' ) ) {
51
- require_once __DIR__ . '/../navigation-link/shared/item-should-render.php';
52
- require_once __DIR__ . '/../navigation-link/shared/render-submenu-icon.php';
53
- } else {
54
- require_once __DIR__ . '/navigation-link/shared/item-should-render.php';
55
- require_once __DIR__ . '/navigation-link/shared/render-submenu-icon.php';
56
- }
57
-
58
52
  /**
59
53
  * Build an array with CSS classes and inline styles defining the font sizes
60
54
  * which will be applied to the navigation markup in the front-end.
@@ -240,7 +234,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
240
234
  if ( $show_submenu_indicators && $has_submenu ) {
241
235
  // The submenu icon is rendered in a button here
242
236
  // so that there's a clickable element to open the submenu.
243
- $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_render_submenu_icon() . '</button>';
237
+ $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
238
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
239
+ $html .= gutenberg_block_core_shared_navigation_render_submenu_icon();
240
+ } else {
241
+ $html .= block_core_shared_navigation_render_submenu_icon();
242
+ }
243
+ $html .= '</button>';
244
244
  }
245
245
  } else {
246
246
  $html .= '<button aria-label="' . esc_attr( $aria_label ) . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
@@ -262,7 +262,13 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
262
262
  $html .= '</button>';
263
263
 
264
264
  if ( $has_submenu ) {
265
- $html .= '<span class="wp-block-navigation__submenu-icon">' . block_core_navigation_render_submenu_icon() . '</span>';
265
+ $html .= '<span class="wp-block-navigation__submenu-icon">';
266
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
267
+ $html .= gutenberg_block_core_shared_navigation_render_submenu_icon();
268
+ } else {
269
+ $html .= block_core_shared_navigation_render_submenu_icon();
270
+ }
271
+ $html .= '</span>';
266
272
  }
267
273
  }
268
274
 
@@ -9,7 +9,6 @@
9
9
  "parent": [ "core/post-content" ],
10
10
  "textdomain": "default",
11
11
  "supports": {
12
- "anchor": true,
13
12
  "customClassName": false,
14
13
  "className": false,
15
14
  "html": false,
@@ -21,7 +21,7 @@ import {
21
21
  useBlockEditingMode,
22
22
  } from '@wordpress/block-editor';
23
23
  import { getBlockSupport } from '@wordpress/blocks';
24
- import { formatLtr } from '@wordpress/icons';
24
+ import { formatLTR } from '@wordpress/icons';
25
25
  /**
26
26
  * Internal dependencies
27
27
  */
@@ -32,7 +32,7 @@ function ParagraphRTLControl( { direction, setDirection } ) {
32
32
  return (
33
33
  isRTL() && (
34
34
  <ToolbarButton
35
- icon={ formatLtr }
35
+ icon={ formatLTR }
36
36
  title={ _x( 'Left to right', 'editor button' ) }
37
37
  isActive={ direction === 'ltr' }
38
38
  onClick={ () => {
@@ -38,42 +38,10 @@ import { createBlock } from '@wordpress/blocks';
38
38
  import { Caption } from '../utils/caption';
39
39
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
40
40
  import { WaveformPlayer } from '../utils/waveform-player';
41
+ import { getTrackAttributes } from './utils';
41
42
 
42
43
  const ALLOWED_MEDIA_TYPES = [ 'audio' ];
43
44
 
44
- /**
45
- * Transform media library data into track block attributes.
46
- *
47
- * @param {Object} media - Media object from the media library.
48
- * @return {Object} Track attributes for the playlist-track block.
49
- */
50
- function getTrackAttributes( media ) {
51
- return {
52
- id: media.id || media.url, // Attachment ID or URL.
53
- uniqueId: uuid(), // Unique ID for the track.
54
- src: media.url,
55
- title: media.title,
56
- artist:
57
- media.artist ||
58
- media?.meta?.artist ||
59
- media?.media_details?.artist ||
60
- __( 'Unknown artist' ),
61
- album:
62
- media.album ||
63
- media?.meta?.album ||
64
- media?.media_details?.album ||
65
- __( 'Unknown album' ),
66
- length: media?.fileLength || media?.media_details?.length_formatted,
67
- // Prevent using the default media attachment icon as the track image.
68
- // Note: Image is not available when a new track is uploaded.
69
- image:
70
- media?.image?.src &&
71
- media?.image?.src.endsWith( '/images/media/audio.svg' )
72
- ? ''
73
- : media?.image?.src,
74
- };
75
- }
76
-
77
45
  const PlaylistEdit = ( {
78
46
  attributes,
79
47
  setAttributes,
@@ -434,4 +402,3 @@ const PlaylistEdit = ( {
434
402
  };
435
403
 
436
404
  export default PlaylistEdit;
437
- export { getTrackAttributes };
@@ -4,6 +4,11 @@
4
4
  $waveform-player-height: 100px;
5
5
 
6
6
  .wp-block-playlist {
7
+ // Clip content to respect border-radius.
8
+ // `overflow: hidden` is a fallback for browsers that don't support `overflow: clip`.
9
+ overflow: hidden;
10
+ overflow: clip;
11
+
7
12
  // Main waveform player container.
8
13
  .wp-block-playlist__waveform-player {
9
14
  width: 100%;
@@ -5,7 +5,7 @@
5
5
  /**
6
6
  * Internal dependencies
7
7
  */
8
- import { getTrackAttributes } from '../edit';
8
+ import { getTrackAttributes } from '../utils';
9
9
 
10
10
  // Mock uuid to return predictable values.
11
11
  jest.mock( 'uuid', () => ( {
@@ -0,0 +1,42 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import { v4 as uuid } from 'uuid';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { __ } from '@wordpress/i18n';
10
+
11
+ /**
12
+ * Transform media library data into track block attributes.
13
+ *
14
+ * @param {Object} media - Media object from the media library.
15
+ * @return {Object} Track attributes for the playlist-track block.
16
+ */
17
+ export function getTrackAttributes( media ) {
18
+ return {
19
+ id: media.id || media.url, // Attachment ID or URL.
20
+ uniqueId: uuid(), // Unique ID for the track.
21
+ src: media.url,
22
+ title: media.title,
23
+ artist:
24
+ media.artist ||
25
+ media?.meta?.artist ||
26
+ media?.media_details?.artist ||
27
+ __( 'Unknown artist' ),
28
+ album:
29
+ media.album ||
30
+ media?.meta?.album ||
31
+ media?.media_details?.album ||
32
+ __( 'Unknown album' ),
33
+ length: media?.fileLength || media?.media_details?.length_formatted,
34
+ // Prevent using the default media attachment icon as the track image.
35
+ // Note: Image is not available when a new track is uploaded.
36
+ image:
37
+ media?.image?.src &&
38
+ media?.image?.src.endsWith( '/images/media/audio.svg' )
39
+ ? ''
40
+ : media?.image?.src,
41
+ };
42
+ }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -7,9 +7,6 @@
7
7
  "description": "Display the excerpt.",
8
8
  "textdomain": "default",
9
9
  "attributes": {
10
- "textAlign": {
11
- "type": "string"
12
- },
13
10
  "moreText": {
14
11
  "type": "string",
15
12
  "role": "content"
@@ -46,6 +43,7 @@
46
43
  "typography": {
47
44
  "fontSize": true,
48
45
  "lineHeight": true,
46
+ "textAlign": true,
49
47
  "textColumns": true,
50
48
  "__experimentalFontFamily": true,
51
49
  "__experimentalFontWeight": true,
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import migrateTextAlign from '../utils/migrate-text-align';
5
+
6
+ const v1 = {
7
+ attributes: {
8
+ textAlign: {
9
+ type: 'string',
10
+ },
11
+ moreText: {
12
+ type: 'string',
13
+ role: 'content',
14
+ },
15
+ showMoreOnNewLine: {
16
+ type: 'boolean',
17
+ default: true,
18
+ },
19
+ excerptLength: {
20
+ type: 'number',
21
+ default: 55,
22
+ },
23
+ },
24
+ supports: {
25
+ anchor: true,
26
+ html: false,
27
+ color: {
28
+ gradients: true,
29
+ link: true,
30
+ __experimentalDefaultControls: {
31
+ background: true,
32
+ text: true,
33
+ link: true,
34
+ },
35
+ },
36
+ spacing: {
37
+ margin: true,
38
+ padding: true,
39
+ },
40
+ typography: {
41
+ fontSize: true,
42
+ lineHeight: true,
43
+ textColumns: true,
44
+ __experimentalFontFamily: true,
45
+ __experimentalFontWeight: true,
46
+ __experimentalFontStyle: true,
47
+ __experimentalTextTransform: true,
48
+ __experimentalTextDecoration: true,
49
+ __experimentalLetterSpacing: true,
50
+ __experimentalDefaultControls: {
51
+ fontSize: true,
52
+ },
53
+ },
54
+ interactivity: {
55
+ clientNavigation: true,
56
+ },
57
+ __experimentalBorder: {
58
+ radius: true,
59
+ color: true,
60
+ width: true,
61
+ style: true,
62
+ __experimentalDefaultControls: {
63
+ radius: true,
64
+ color: true,
65
+ width: true,
66
+ style: true,
67
+ },
68
+ },
69
+ },
70
+ save() {
71
+ return null;
72
+ },
73
+ migrate: migrateTextAlign,
74
+ isEligible( attributes ) {
75
+ return (
76
+ !! attributes.textAlign ||
77
+ !! attributes.className?.match(
78
+ /\bhas-text-align-(left|center|right)\b/
79
+ )
80
+ );
81
+ },
82
+ };
83
+
84
+ export default [ v1 ];
@@ -9,13 +9,10 @@ import clsx from 'clsx';
9
9
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
10
10
  import { useMemo } from '@wordpress/element';
11
11
  import {
12
- AlignmentToolbar,
13
- BlockControls,
14
12
  InspectorControls,
15
13
  RichText,
16
14
  Warning,
17
15
  useBlockProps,
18
- useBlockEditingMode,
19
16
  } from '@wordpress/block-editor';
20
17
  import {
21
18
  ToggleControl,
@@ -33,17 +30,19 @@ import {
33
30
  useCanEditEntity,
34
31
  useToolsPanelDropdownMenuProps,
35
32
  } from '../utils/hooks';
33
+ import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes';
36
34
 
37
35
  const ELLIPSIS = '…';
38
36
 
39
- export default function PostExcerptEditor( {
40
- attributes: { textAlign, moreText, showMoreOnNewLine, excerptLength },
41
- setAttributes,
42
- isSelected,
43
- context: { postId, postType, queryId },
44
- } ) {
45
- const blockEditingMode = useBlockEditingMode();
46
- const showControls = blockEditingMode === 'default';
37
+ export default function PostExcerptEditor( props ) {
38
+ const {
39
+ attributes: { moreText, showMoreOnNewLine, excerptLength },
40
+ setAttributes,
41
+ isSelected,
42
+ context: { postId, postType, queryId },
43
+ } = props;
44
+ useDeprecatedTextAlign( props );
45
+
47
46
  const isDescendentOfQueryLoop = Number.isFinite( queryId );
48
47
  const userCanEdit = useCanEditEntity( 'postType', postType, postId );
49
48
  const [
@@ -83,11 +82,7 @@ export default function PostExcerptEditor( {
83
82
  const isEditable =
84
83
  userCanEdit && ! isDescendentOfQueryLoop && postTypeSupportsExcerpts;
85
84
 
86
- const blockProps = useBlockProps( {
87
- className: clsx( {
88
- [ `has-text-align-${ textAlign }` ]: textAlign,
89
- } ),
90
- } );
85
+ const blockProps = useBlockProps();
91
86
 
92
87
  /**
93
88
  * translators: If your word count is based on single characters (e.g. East Asian characters),
@@ -114,19 +109,9 @@ export default function PostExcerptEditor( {
114
109
 
115
110
  if ( ! postType || ! postId ) {
116
111
  return (
117
- <>
118
- <BlockControls>
119
- <AlignmentToolbar
120
- value={ textAlign }
121
- onChange={ ( newAlign ) =>
122
- setAttributes( { textAlign: newAlign } )
123
- }
124
- />
125
- </BlockControls>
126
- <div { ...blockProps }>
127
- <p>{ __( 'This block will display the excerpt.' ) }</p>
128
- </div>
129
- </>
112
+ <div { ...blockProps }>
113
+ <p>{ __( 'This block will display the excerpt.' ) }</p>
114
+ </div>
130
115
  );
131
116
  }
132
117
  if ( isProtected && ! userCanEdit ) {
@@ -225,16 +210,6 @@ export default function PostExcerptEditor( {
225
210
  );
226
211
  return (
227
212
  <>
228
- { showControls && (
229
- <BlockControls>
230
- <AlignmentToolbar
231
- value={ textAlign }
232
- onChange={ ( newAlign ) =>
233
- setAttributes( { textAlign: newAlign } )
234
- }
235
- />
236
- </BlockControls>
237
- ) }
238
213
  <InspectorControls>
239
214
  <ToolsPanel
240
215
  label={ __( 'Settings' ) }
@@ -10,6 +10,7 @@ import initBlock from '../utils/init-block';
10
10
  import metadata from './block.json';
11
11
  import edit from './edit';
12
12
  import transforms from './transforms';
13
+ import deprecated from './deprecated';
13
14
 
14
15
  const { name } = metadata;
15
16
  export { metadata, name };
@@ -18,6 +19,7 @@ export const settings = {
18
19
  icon,
19
20
  transforms,
20
21
  edit,
22
+ deprecated,
21
23
  };
22
24
 
23
25
  export const init = () => initBlock( { name, metadata, settings } );
@@ -3,6 +3,7 @@
3
3
  */
4
4
  import { default as BlockKeyboardShortcuts } from './block-keyboard-shortcuts';
5
5
  import { NAVIGATION_OVERLAY_TEMPLATE_PART_AREA } from './navigation/constants';
6
+ import { NavigationLinkUI } from './navigation/edit/navigation-link-ui';
6
7
  import { lock } from './lock-unlock';
7
8
 
8
9
  /**
@@ -12,4 +13,5 @@ export const privateApis = {};
12
13
  lock( privateApis, {
13
14
  BlockKeyboardShortcuts,
14
15
  NAVIGATION_OVERLAY_TEMPLATE_PART_AREA,
16
+ NavigationLinkUI,
15
17
  } );
@@ -17,7 +17,8 @@
17
17
  "className": false,
18
18
  "customClassName": false,
19
19
  "html": false,
20
- "customCSS": false
20
+ "customCSS": false,
21
+ "visibility": false
21
22
  },
22
23
  "editorStyle": "wp-block-shortcode-editor"
23
24
  }
@@ -620,7 +620,6 @@ export default function LogoEdit( {
620
620
  >
621
621
  <MediaControlPreview
622
622
  url={ mediaItemData?.source_url }
623
- alt={ mediaItemData?.alt_text }
624
623
  filename={
625
624
  mediaItemData?.media_details?.sizes?.full
626
625
  ?.file || mediaItemData?.slug
@@ -642,7 +641,6 @@ export default function LogoEdit( {
642
641
  <MediaControl
643
642
  mediaId={ siteLogoId }
644
643
  mediaUrl={ logoUrl }
645
- alt={ mediaItemData?.alt_text }
646
644
  filename={
647
645
  mediaItemData?.media_details?.sizes?.full
648
646
  ?.file || mediaItemData?.slug
@@ -652,7 +650,7 @@ export default function LogoEdit( {
652
650
  onError={ onUploadError }
653
651
  onReset={ onRemoveLogo }
654
652
  isUploading={ !! temporaryURL }
655
- emptyLabel={ __( 'Choose logo' ) }
653
+ emptyLabel={ __( 'Logo' ) }
656
654
  />
657
655
  </ToolsPanelItem>
658
656
  ) }
@@ -12,7 +12,8 @@ import { useDispatch, useSelect } from '@wordpress/data';
12
12
 
13
13
  /**
14
14
  * "Add tab" button in the block toolbar for the tab block.
15
- * Inserts new tabs into the tab-panel block.
15
+ * Inserts a new core/tab into the tab-panel and a new core/tabs-menu-item
16
+ * into the tabs-menu, keeping both in sync.
16
17
  *
17
18
  * @param {Object} props
18
19
  * @param {string} props.tabsClientId The client ID of the parent tabs block.
@@ -21,39 +22,63 @@ import { useDispatch, useSelect } from '@wordpress/data';
21
22
  export default function AddTabToolbarControl( { tabsClientId } ) {
22
23
  const { insertBlock } = useDispatch( blockEditorStore );
23
24
 
24
- // Find the tab-panel block within the tabs block
25
- const { tabPanelClientId, nextTabIndex } = useSelect(
26
- ( select ) => {
27
- if ( ! tabsClientId ) {
25
+ const { tabPanelClientId, tabsMenuClientId, tabCount, existingAnchors } =
26
+ useSelect(
27
+ ( select ) => {
28
+ if ( ! tabsClientId ) {
29
+ return {
30
+ tabPanelClientId: null,
31
+ tabsMenuClientId: null,
32
+ existingAnchors: [],
33
+ };
34
+ }
35
+ const { getBlocks } = select( blockEditorStore );
36
+ const innerBlocks = getBlocks( tabsClientId );
37
+ const tabPanel = innerBlocks.find(
38
+ ( block ) => block.name === 'core/tab-panel'
39
+ );
40
+ const tabsMenu = innerBlocks.find(
41
+ ( block ) => block.name === 'core/tabs-menu'
42
+ );
28
43
  return {
29
- tabPanelClientId: null,
30
- nextTabIndex: 0,
44
+ tabPanelClientId: tabPanel?.clientId || null,
45
+ tabsMenuClientId: tabsMenu?.clientId || null,
46
+ tabCount: tabPanel?.innerBlocks?.length || 0,
47
+ existingAnchors: ( tabPanel?.innerBlocks || [] )
48
+ .map( ( block ) => block.attributes.anchor )
49
+ .filter( Boolean ),
31
50
  };
32
- }
33
- const { getBlocks } = select( blockEditorStore );
34
- const innerBlocks = getBlocks( tabsClientId );
35
- const tabPanel = innerBlocks.find(
36
- ( block ) => block.name === 'core/tab-panel'
37
- );
38
- return {
39
- tabPanelClientId: tabPanel?.clientId || null,
40
- nextTabIndex: ( tabPanel?.innerBlocks.length || 0 ) + 1,
41
- };
42
- },
43
- [ tabsClientId ]
44
- );
51
+ },
52
+ [ tabsClientId ]
53
+ );
45
54
 
46
55
  const addTab = () => {
47
56
  if ( ! tabPanelClientId ) {
48
57
  return;
49
58
  }
59
+
60
+ // Start from count + 1 so the label stays sequential, then increment
61
+ // until the anchor slot is free.
62
+ const existingAnchorSet = new Set( existingAnchors );
63
+ let tabNumber = tabCount + 1;
64
+ while ( existingAnchorSet.has( `tab-${ tabNumber }` ) ) {
65
+ tabNumber++;
66
+ }
67
+
50
68
  const newTabBlock = createBlock( 'core/tab', {
51
- anchor: 'tab-' + nextTabIndex,
69
+ anchor: `tab-${ tabNumber }`,
52
70
  /* translators: %d: tab number */
53
- label: sprintf( __( 'Tab %d' ), nextTabIndex ),
71
+ label: sprintf( __( 'Tab %d' ), tabNumber ),
54
72
  } );
55
73
  insertBlock( newTabBlock, undefined, tabPanelClientId );
56
- // @TODO: Possible select and focus the tabs-menu-item active tab RichText editor?
74
+
75
+ // Insert a corresponding menu item into the tabs-menu.
76
+ if ( tabsMenuClientId ) {
77
+ const newMenuItemBlock = createBlock( 'core/tabs-menu-item', {
78
+ anchor: `tab-${ tabNumber }-button`,
79
+ } );
80
+ insertBlock( newMenuItemBlock, undefined, tabsMenuClientId );
81
+ }
57
82
  };
58
83
 
59
84
  return (