@wordpress/block-library 9.40.2-next.v.202602241322.0 → 9.40.2

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 (226) hide show
  1. package/build/comment-reply-link/edit.cjs +2 -1
  2. package/build/comment-reply-link/edit.cjs.map +2 -2
  3. package/build/comments/edit/placeholder.cjs +2 -1
  4. package/build/comments/edit/placeholder.cjs.map +2 -2
  5. package/build/cover/edit/index.cjs +39 -26
  6. package/build/cover/edit/index.cjs.map +2 -2
  7. package/build/cover/embed-video-utils.cjs +8 -6
  8. package/build/cover/embed-video-utils.cjs.map +2 -2
  9. package/build/embed/embed-preview.cjs +2 -1
  10. package/build/embed/embed-preview.cjs.map +2 -2
  11. package/build/html/block.json +2 -1
  12. package/build/html/modal.cjs +147 -230
  13. package/build/html/modal.cjs.map +3 -3
  14. package/build/icon/block.json +3 -12
  15. package/build/image/image.cjs +1 -1
  16. package/build/image/image.cjs.map +2 -2
  17. package/build/latest-comments/deprecated.cjs +33 -0
  18. package/build/latest-comments/deprecated.cjs.map +2 -2
  19. package/build/navigation/edit/index.cjs +123 -119
  20. package/build/navigation/edit/index.cjs.map +3 -3
  21. package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
  22. package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
  23. package/build/navigation/view.cjs +9 -2
  24. package/build/navigation/view.cjs.map +2 -2
  25. package/build/navigation-link/edit.cjs +2 -1
  26. package/build/navigation-link/edit.cjs.map +2 -2
  27. package/build/navigation-link/shared/controls.cjs +29 -52
  28. package/build/navigation-link/shared/controls.cjs.map +3 -3
  29. package/build/navigation-link/shared/use-handle-link-change.cjs +19 -3
  30. package/build/navigation-link/shared/use-handle-link-change.cjs.map +3 -3
  31. package/build/navigation-link/shared/use-link-preview.cjs +8 -9
  32. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  33. package/build/navigation-submenu/edit.cjs +8 -22
  34. package/build/navigation-submenu/edit.cjs.map +2 -2
  35. package/build/nextpage/block.json +0 -1
  36. package/build/page-list-item/edit.cjs +6 -3
  37. package/build/page-list-item/edit.cjs.map +2 -2
  38. package/build/paragraph/edit.cjs +1 -1
  39. package/build/paragraph/edit.cjs.map +1 -1
  40. package/build/post-navigation-link/block.json +3 -1
  41. package/build/post-navigation-link/edit.cjs +36 -2
  42. package/build/post-navigation-link/edit.cjs.map +3 -3
  43. package/build/post-navigation-link/index.cjs +0 -2
  44. package/build/post-navigation-link/index.cjs.map +3 -3
  45. package/build/post-title/block.json +3 -1
  46. package/build/post-title/deprecated.cjs +1 -82
  47. package/build/post-title/deprecated.cjs.map +3 -3
  48. package/build/post-title/edit.cjs +36 -10
  49. package/build/post-title/edit.cjs.map +3 -3
  50. package/build/query-title/block.json +3 -1
  51. package/build/query-title/deprecated.cjs +1 -70
  52. package/build/query-title/deprecated.cjs.map +3 -3
  53. package/build/query-title/edit.cjs +35 -17
  54. package/build/query-title/edit.cjs.map +3 -3
  55. package/build/shortcode/block.json +2 -1
  56. package/build/site-tagline/block.json +4 -6
  57. package/build/site-tagline/deprecated.cjs +1 -66
  58. package/build/site-tagline/deprecated.cjs.map +3 -3
  59. package/build/site-tagline/edit.cjs +28 -14
  60. package/build/site-tagline/edit.cjs.map +3 -3
  61. package/build/site-title/block.json +3 -1
  62. package/build/site-title/deprecated.cjs +1 -79
  63. package/build/site-title/deprecated.cjs.map +3 -3
  64. package/build/site-title/edit.cjs +30 -14
  65. package/build/site-title/edit.cjs.map +3 -3
  66. package/build/tabs-menu-item/block.json +26 -1
  67. package/build/tabs-menu-item/controls.cjs +100 -2
  68. package/build/tabs-menu-item/controls.cjs.map +3 -3
  69. package/build/tabs-menu-item/edit.cjs +65 -6
  70. package/build/tabs-menu-item/edit.cjs.map +2 -2
  71. package/build/tabs-menu-item/save.cjs +15 -1
  72. package/build/tabs-menu-item/save.cjs.map +2 -2
  73. package/build-module/comment-reply-link/edit.mjs +3 -2
  74. package/build-module/comment-reply-link/edit.mjs.map +2 -2
  75. package/build-module/comments/edit/placeholder.mjs +3 -2
  76. package/build-module/comments/edit/placeholder.mjs.map +2 -2
  77. package/build-module/cover/edit/index.mjs +47 -29
  78. package/build-module/cover/edit/index.mjs.map +2 -2
  79. package/build-module/cover/embed-video-utils.mjs +7 -5
  80. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  81. package/build-module/embed/embed-preview.mjs +2 -1
  82. package/build-module/embed/embed-preview.mjs.map +2 -2
  83. package/build-module/html/block.json +2 -1
  84. package/build-module/html/modal.mjs +149 -232
  85. package/build-module/html/modal.mjs.map +2 -2
  86. package/build-module/icon/block.json +3 -12
  87. package/build-module/image/image.mjs +1 -1
  88. package/build-module/image/image.mjs.map +2 -2
  89. package/build-module/latest-comments/deprecated.mjs +33 -0
  90. package/build-module/latest-comments/deprecated.mjs.map +2 -2
  91. package/build-module/navigation/edit/index.mjs +123 -119
  92. package/build-module/navigation/edit/index.mjs.map +2 -2
  93. package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
  94. package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
  95. package/build-module/navigation/view.mjs +9 -2
  96. package/build-module/navigation/view.mjs.map +2 -2
  97. package/build-module/navigation-link/edit.mjs +2 -1
  98. package/build-module/navigation-link/edit.mjs.map +2 -2
  99. package/build-module/navigation-link/shared/controls.mjs +29 -53
  100. package/build-module/navigation-link/shared/controls.mjs.map +2 -2
  101. package/build-module/navigation-link/shared/use-handle-link-change.mjs +19 -3
  102. package/build-module/navigation-link/shared/use-handle-link-change.mjs.map +2 -2
  103. package/build-module/navigation-link/shared/use-link-preview.mjs +8 -9
  104. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  105. package/build-module/navigation-submenu/edit.mjs +9 -23
  106. package/build-module/navigation-submenu/edit.mjs.map +2 -2
  107. package/build-module/nextpage/block.json +0 -1
  108. package/build-module/page-list-item/edit.mjs +6 -3
  109. package/build-module/page-list-item/edit.mjs.map +2 -2
  110. package/build-module/paragraph/edit.mjs +2 -2
  111. package/build-module/paragraph/edit.mjs.map +1 -1
  112. package/build-module/post-navigation-link/block.json +3 -1
  113. package/build-module/post-navigation-link/edit.mjs +30 -3
  114. package/build-module/post-navigation-link/edit.mjs.map +2 -2
  115. package/build-module/post-navigation-link/index.mjs +0 -2
  116. package/build-module/post-navigation-link/index.mjs.map +2 -2
  117. package/build-module/post-title/block.json +3 -1
  118. package/build-module/post-title/deprecated.mjs +1 -82
  119. package/build-module/post-title/deprecated.mjs.map +2 -2
  120. package/build-module/post-title/edit.mjs +27 -10
  121. package/build-module/post-title/edit.mjs.map +2 -2
  122. package/build-module/query-title/block.json +3 -1
  123. package/build-module/query-title/deprecated.mjs +1 -70
  124. package/build-module/query-title/deprecated.mjs.map +2 -2
  125. package/build-module/query-title/edit.mjs +36 -17
  126. package/build-module/query-title/edit.mjs.map +2 -2
  127. package/build-module/shortcode/block.json +2 -1
  128. package/build-module/site-tagline/block.json +4 -6
  129. package/build-module/site-tagline/deprecated.mjs +1 -66
  130. package/build-module/site-tagline/deprecated.mjs.map +2 -2
  131. package/build-module/site-tagline/edit.mjs +29 -14
  132. package/build-module/site-tagline/edit.mjs.map +2 -2
  133. package/build-module/site-title/block.json +3 -1
  134. package/build-module/site-title/deprecated.mjs +1 -79
  135. package/build-module/site-title/deprecated.mjs.map +2 -2
  136. package/build-module/site-title/edit.mjs +31 -14
  137. package/build-module/site-title/edit.mjs.map +2 -2
  138. package/build-module/tabs-menu-item/block.json +26 -1
  139. package/build-module/tabs-menu-item/controls.mjs +104 -3
  140. package/build-module/tabs-menu-item/controls.mjs.map +2 -2
  141. package/build-module/tabs-menu-item/edit.mjs +66 -6
  142. package/build-module/tabs-menu-item/edit.mjs.map +2 -2
  143. package/build-module/tabs-menu-item/save.mjs +15 -1
  144. package/build-module/tabs-menu-item/save.mjs.map +2 -2
  145. package/build-style/editor-rtl.css +30 -6
  146. package/build-style/editor.css +30 -6
  147. package/build-style/html/editor-rtl.css +10 -6
  148. package/build-style/html/editor.css +10 -6
  149. package/build-style/icon/editor-rtl.css +5 -0
  150. package/build-style/icon/editor.css +5 -0
  151. package/build-style/navigation/style-rtl.css +15 -1
  152. package/build-style/navigation/style.css +15 -1
  153. package/build-style/navigation-link/editor-rtl.css +10 -0
  154. package/build-style/navigation-link/editor.css +10 -0
  155. package/build-style/navigation-overlay-close/style-rtl.css +3 -3
  156. package/build-style/navigation-overlay-close/style.css +3 -3
  157. package/build-style/style-rtl.css +30 -7
  158. package/build-style/style.css +30 -7
  159. package/build-style/tabs-menu-item/editor-rtl.css +5 -0
  160. package/build-style/tabs-menu-item/editor.css +5 -0
  161. package/build-style/tabs-menu-item/style-rtl.css +12 -3
  162. package/build-style/tabs-menu-item/style.css +12 -3
  163. package/package.json +38 -38
  164. package/src/accordion-item/index.php +17 -5
  165. package/src/comment-reply-link/edit.js +5 -2
  166. package/src/comments/edit/placeholder.js +5 -2
  167. package/src/cover/edit/index.js +72 -35
  168. package/src/cover/embed-video-utils.js +9 -7
  169. package/src/cover/index.php +8 -0
  170. package/src/details/index.php +47 -0
  171. package/src/embed/embed-preview.js +6 -5
  172. package/src/html/block.json +2 -1
  173. package/src/html/editor.scss +15 -5
  174. package/src/html/modal.js +32 -99
  175. package/src/icon/block.json +3 -12
  176. package/src/icon/editor.scss +5 -0
  177. package/src/icon/index.php +3 -1
  178. package/src/image/image.js +14 -15
  179. package/src/image/index.php +7 -5
  180. package/src/latest-comments/deprecated.js +33 -0
  181. package/src/navigation/edit/index.js +134 -130
  182. package/src/navigation/edit/navigation-menu-selector.js +2 -1
  183. package/src/navigation/index.php +62 -9
  184. package/src/navigation/style.scss +17 -1
  185. package/src/navigation/view.js +14 -2
  186. package/src/navigation-link/edit.js +1 -0
  187. package/src/navigation-link/editor.scss +18 -0
  188. package/src/navigation-link/shared/controls.js +35 -62
  189. package/src/navigation-link/shared/test/controls.js +5 -5
  190. package/src/navigation-link/shared/test/use-handle-link-change.test.js +212 -0
  191. package/src/navigation-link/shared/test/use-link-preview.test.js +19 -1
  192. package/src/navigation-link/shared/use-handle-link-change.js +36 -9
  193. package/src/navigation-link/shared/use-link-preview.js +14 -15
  194. package/src/navigation-overlay-close/style.scss +3 -3
  195. package/src/navigation-submenu/edit.js +11 -28
  196. package/src/nextpage/block.json +0 -1
  197. package/src/page-list-item/edit.js +8 -7
  198. package/src/paragraph/edit.js +2 -2
  199. package/src/post-featured-image/index.php +4 -2
  200. package/src/post-navigation-link/block.json +3 -1
  201. package/src/post-navigation-link/edit.js +35 -2
  202. package/src/post-navigation-link/index.js +0 -2
  203. package/src/post-title/block.json +3 -1
  204. package/src/post-title/deprecated.js +1 -86
  205. package/src/post-title/edit.js +18 -2
  206. package/src/query-title/block.json +3 -1
  207. package/src/query-title/deprecated.js +1 -74
  208. package/src/query-title/edit.js +27 -11
  209. package/src/shortcode/block.json +2 -1
  210. package/src/site-tagline/block.json +4 -6
  211. package/src/site-tagline/deprecated.js +1 -70
  212. package/src/site-tagline/edit.js +22 -9
  213. package/src/site-title/block.json +3 -1
  214. package/src/site-title/deprecated.js +1 -83
  215. package/src/site-title/edit.js +22 -9
  216. package/src/tabs-menu-item/block.json +26 -1
  217. package/src/tabs-menu-item/controls.js +108 -0
  218. package/src/tabs-menu-item/edit.js +79 -6
  219. package/src/tabs-menu-item/editor.scss +6 -0
  220. package/src/tabs-menu-item/save.js +26 -1
  221. package/src/tabs-menu-item/style.scss +14 -3
  222. package/build/post-navigation-link/deprecated.cjs +0 -100
  223. package/build/post-navigation-link/deprecated.cjs.map +0 -7
  224. package/build-module/post-navigation-link/deprecated.mjs +0 -69
  225. package/build-module/post-navigation-link/deprecated.mjs.map +0 -7
  226. package/src/post-navigation-link/deprecated.js +0 -72
@@ -74,18 +74,20 @@ function findVideoEmbedProvider( url ) {
74
74
  }
75
75
 
76
76
  /**
77
- * Extracts iframe src from embed HTML.
77
+ * Modifies embed HTML to use background video parameters.
78
78
  *
79
- * @param {string} html The embed HTML.
80
- * @return {string|null} The iframe src URL or null if not found.
79
+ * @param {string} html The original embed HTML.
80
+ * @return {string|null} The modified embed HTML, or null if not possible.
81
81
  */
82
- export function getIframeSrc( html ) {
83
- if ( ! html ) {
82
+ export function getBackgroundEmbedHtml( html ) {
83
+ const srcMatch = html?.match( /src=["']([^"']+)["']/ );
84
+ if ( ! srcMatch ) {
84
85
  return null;
85
86
  }
86
87
 
87
- const srcMatch = html.match( /src=["']([^"']+)["']/ );
88
- return srcMatch ? srcMatch[ 1 ] : null;
88
+ const iframeSrc = srcMatch[ 1 ];
89
+ const backgroundSrc = getBackgroundVideoSrc( iframeSrc );
90
+ return html.replace( iframeSrc, backgroundSrc );
89
91
  }
90
92
 
91
93
  /**
@@ -66,6 +66,14 @@ function render_block_core_cover( $attributes, $content ) {
66
66
  $query_params['controls'] = '0';
67
67
  $query_params['modestbranding'] = '1';
68
68
  $query_params['playsinline'] = '1';
69
+
70
+ // For loop to work, we need the playlist parameter.
71
+ $path = $parsed_url['path'] ?? '';
72
+ $path_segments = explode( '/', $path );
73
+ $video_id = end( $path_segments );
74
+ if ( $video_id ) {
75
+ $query_params['playlist'] = $video_id;
76
+ }
69
77
  } elseif ( 'vimeo' === $provider ) {
70
78
  $query_params['autoplay'] = '1';
71
79
  $query_params['muted'] = '1';
@@ -0,0 +1,47 @@
1
+ <?php
2
+ /**
3
+ * Server-side rendering of the `core/details` block.
4
+ *
5
+ * @package WordPress
6
+ */
7
+
8
+ /**
9
+ * Sets fetchpriority="low" on all IMG tags within the collapsed Details block.
10
+ *
11
+ * Images in a collapsed Details block are hidden until the block is expanded, so they should
12
+ * not compete with any resources in the critical rendering path, such as the LCP element image.
13
+ *
14
+ * @since 7.0.0
15
+ *
16
+ * @param string $block_content The block content.
17
+ * @param array $block The full block, including name and attributes.
18
+ * @return string Modified HTML with fetchpriority="low" on all IMG tags when the showContent attribute is false.
19
+ */
20
+ function block_core_details_set_img_fetchpriority_low( $block_content, array $block ): string {
21
+ if ( ! is_string( $block_content ) ) {
22
+ return '';
23
+ }
24
+
25
+ // If the Details block is open by default, short-circuit to let core add fetchpriority=high if appropriate.
26
+ if ( $block['attrs']['showContent'] ?? false ) {
27
+ return $block_content;
28
+ }
29
+
30
+ $tags = new WP_HTML_Tag_Processor( $block_content );
31
+ while ( $tags->next_tag( 'IMG' ) ) {
32
+ $tags->set_attribute( 'fetchpriority', 'low' );
33
+ }
34
+ return $tags->get_updated_html();
35
+ }
36
+
37
+ add_filter( 'render_block_core/details', 'block_core_details_set_img_fetchpriority_low', 10, 2 );
38
+
39
+ /**
40
+ * Registers the `core/details` block on server.
41
+ *
42
+ * @since 7.0.0
43
+ */
44
+ function register_block_core_details() {
45
+ register_block_type_from_metadata( __DIR__ . '/details' );
46
+ }
47
+ add_action( 'init', 'register_block_core_details' );
@@ -1,8 +1,3 @@
1
- /**
2
- * Internal dependencies
3
- */
4
- import { getPhotoHtml } from './util';
5
-
6
1
  /**
7
2
  * External dependencies
8
3
  */
@@ -17,6 +12,11 @@ import { BlockIcon } from '@wordpress/block-editor';
17
12
  import { useState } from '@wordpress/element';
18
13
  import { getAuthority } from '@wordpress/url';
19
14
 
15
+ /**
16
+ * Internal dependencies
17
+ */
18
+ import { getPhotoHtml } from './util';
19
+
20
20
  /**
21
21
  * Internal dependencies
22
22
  */
@@ -75,6 +75,7 @@ export default function EmbedPreview( {
75
75
  ) : (
76
76
  <div className="wp-block-embed__wrapper">
77
77
  <SandBox
78
+ allowSameOrigin
78
79
  html={ html }
79
80
  scripts={ scripts }
80
81
  title={ iframeTitle }
@@ -21,7 +21,8 @@
21
21
  "interactivity": {
22
22
  "clientNavigation": true
23
23
  },
24
- "customCSS": false
24
+ "customCSS": false,
25
+ "visibility": false
25
26
  },
26
27
  "editorStyle": "wp-block-html-editor"
27
28
  }
@@ -14,7 +14,14 @@
14
14
 
15
15
  // Modal styles
16
16
  .block-library-html__modal {
17
- height: 100%;
17
+
18
+ // On medium and large screens, the modal component sets a max-height.
19
+ // We want the modal to be as tall as possible also when the content is short.
20
+ @include break-small() {
21
+ &:not(.is-full-screen) {
22
+ height: 9999rem;
23
+ }
24
+ }
18
25
 
19
26
  .components-modal__children-container {
20
27
  height: 100%;
@@ -22,12 +29,11 @@
22
29
  }
23
30
 
24
31
  .block-library-html__modal-tabs {
25
- overflow-y: auto;
32
+ flex: 1;
26
33
  }
27
34
 
28
35
  .block-library-html__modal-content {
29
36
  flex: 1;
30
- min-height: 0;
31
37
  }
32
38
 
33
39
  .block-library-html__modal-tab {
@@ -71,7 +77,11 @@
71
77
  display: flex;
72
78
  align-items: center;
73
79
  justify-content: center;
74
- padding: $grid-unit-20;
75
- flex: 1;
76
80
  min-height: 0;
81
+ overflow-y: auto;
82
+ flex: 1;
83
+
84
+ iframe {
85
+ height: 100%;
86
+ }
77
87
  }
package/src/html/modal.js CHANGED
@@ -10,11 +10,12 @@ import {
10
10
  Flex,
11
11
  Notice,
12
12
  privateApis as componentsPrivateApis,
13
+ __experimentalVStack as VStack,
13
14
  __experimentalHStack as HStack,
14
- __experimentalGrid as Grid,
15
15
  } from '@wordpress/components';
16
16
  import { PlainText, store as blockEditorStore } from '@wordpress/block-editor';
17
17
  import { fullscreen, square } from '@wordpress/icons';
18
+ import { useViewportMatch } from '@wordpress/compose';
18
19
 
19
20
  /**
20
21
  * Internal dependencies
@@ -36,10 +37,10 @@ export default function HTMLEditModal( {
36
37
  const [ editedHtml, setEditedHtml ] = useState( html );
37
38
  const [ editedCss, setEditedCss ] = useState( css );
38
39
  const [ editedJs, setEditedJs ] = useState( js );
39
- const [ isDirty, setIsDirty ] = useState( false );
40
- const [ showUnsavedWarning, setShowUnsavedWarning ] = useState( false );
41
40
  const [ isFullscreen, setIsFullscreen ] = useState( false );
42
41
 
42
+ const isMobileViewport = useViewportMatch( 'small', '<' );
43
+
43
44
  // Check if user has permission to save scripts and get editor styles
44
45
  const { canUserUseUnfilteredHTML } = useSelect( ( select ) => {
45
46
  const settings = select( blockEditorStore ).getSettings();
@@ -57,18 +58,6 @@ export default function HTMLEditModal( {
57
58
  return null;
58
59
  }
59
60
 
60
- const handleHtmlChange = ( value ) => {
61
- setEditedHtml( value );
62
- setIsDirty( true );
63
- };
64
- const handleCssChange = ( value ) => {
65
- setEditedCss( value );
66
- setIsDirty( true );
67
- };
68
- const handleJsChange = ( value ) => {
69
- setEditedJs( value );
70
- setIsDirty( true );
71
- };
72
61
  const handleUpdate = () => {
73
62
  // For users without unfiltered_html capability, strip CSS and JS content
74
63
  // to prevent kses from leaving broken content
@@ -79,25 +68,6 @@ export default function HTMLEditModal( {
79
68
  js: canUserUseUnfilteredHTML ? editedJs : '',
80
69
  } ),
81
70
  } );
82
- setIsDirty( false );
83
- };
84
- const handleCancel = () => {
85
- setIsDirty( false );
86
- onRequestClose();
87
- };
88
- const handleRequestClose = () => {
89
- if ( isDirty ) {
90
- setShowUnsavedWarning( true );
91
- } else {
92
- onRequestClose();
93
- }
94
- };
95
- const handleDiscardChanges = () => {
96
- setShowUnsavedWarning( false );
97
- onRequestClose();
98
- };
99
- const handleContinueEditing = () => {
100
- setShowUnsavedWarning( false );
101
71
  };
102
72
  const handleUpdateAndClose = () => {
103
73
  handleUpdate();
@@ -111,22 +81,16 @@ export default function HTMLEditModal( {
111
81
  <>
112
82
  <Modal
113
83
  title={ __( 'Edit HTML' ) }
114
- onRequestClose={ handleRequestClose }
84
+ onRequestClose={ onRequestClose }
115
85
  className="block-library-html__modal"
116
86
  size="large"
117
87
  isDismissible={ false }
118
- shouldCloseOnClickOutside={ ! isDirty }
119
- shouldCloseOnEsc={ ! isDirty }
88
+ shouldCloseOnClickOutside={ false }
120
89
  isFullScreen={ isFullscreen }
121
90
  __experimentalHideHeader
122
91
  >
123
92
  <Tabs orientation="horizontal" defaultTabId="html">
124
- <Grid
125
- columns={ 1 }
126
- templateRows="auto 1fr auto"
127
- gap={ 4 }
128
- style={ { height: '100%' } }
129
- >
93
+ <VStack expanded>
130
94
  <HStack
131
95
  justify="space-between"
132
96
  className="block-library-html__modal-header"
@@ -144,15 +108,21 @@ export default function HTMLEditModal( {
144
108
  ) }
145
109
  </Tabs.TabList>
146
110
  </div>
147
- <div>
148
- <Button
149
- __next40pxDefaultSize
150
- icon={ isFullscreen ? square : fullscreen }
151
- label={ __( 'Enable/disable fullscreen' ) }
152
- onClick={ toggleFullscreen }
153
- variant="tertiary"
154
- />
155
- </div>
111
+ { ! isMobileViewport && (
112
+ <div>
113
+ <Button
114
+ __next40pxDefaultSize
115
+ icon={
116
+ isFullscreen ? square : fullscreen
117
+ }
118
+ label={ __(
119
+ 'Enable/disable fullscreen'
120
+ ) }
121
+ onClick={ toggleFullscreen }
122
+ variant="tertiary"
123
+ />
124
+ </div>
125
+ ) }
156
126
  </HStack>
157
127
  { hasRestrictedContent && (
158
128
  <Notice
@@ -165,11 +135,11 @@ export default function HTMLEditModal( {
165
135
  ) }
166
136
  </Notice>
167
137
  ) }
168
- <HStack
169
- alignment="stretch"
170
- justify="flex-start"
171
- spacing={ 4 }
138
+ <Flex
139
+ direction={ isMobileViewport ? 'column' : 'row' }
172
140
  className="block-library-html__modal-tabs"
141
+ align="stretch"
142
+ gap={ 8 }
173
143
  >
174
144
  <div className="block-library-html__modal-content">
175
145
  <Tabs.TabPanel
@@ -179,7 +149,7 @@ export default function HTMLEditModal( {
179
149
  >
180
150
  <PlainText
181
151
  value={ editedHtml }
182
- onChange={ handleHtmlChange }
152
+ onChange={ setEditedHtml }
183
153
  placeholder={ __( 'Write HTML…' ) }
184
154
  aria-label={ __( 'HTML' ) }
185
155
  className="block-library-html__modal-editor"
@@ -193,7 +163,7 @@ export default function HTMLEditModal( {
193
163
  >
194
164
  <PlainText
195
165
  value={ editedCss }
196
- onChange={ handleCssChange }
166
+ onChange={ setEditedCss }
197
167
  placeholder={ __( 'Write CSS…' ) }
198
168
  aria-label={ __( 'CSS' ) }
199
169
  className="block-library-html__modal-editor"
@@ -208,7 +178,7 @@ export default function HTMLEditModal( {
208
178
  >
209
179
  <PlainText
210
180
  value={ editedJs }
211
- onChange={ handleJsChange }
181
+ onChange={ setEditedJs }
212
182
  placeholder={ __(
213
183
  'Write JavaScript…'
214
184
  ) }
@@ -227,7 +197,7 @@ export default function HTMLEditModal( {
227
197
  } ) }
228
198
  />
229
199
  </div>
230
- </HStack>
200
+ </Flex>
231
201
  <HStack
232
202
  alignment="center"
233
203
  justify="flex-end"
@@ -237,7 +207,7 @@ export default function HTMLEditModal( {
237
207
  <Button
238
208
  __next40pxDefaultSize
239
209
  variant="tertiary"
240
- onClick={ handleCancel }
210
+ onClick={ onRequestClose }
241
211
  >
242
212
  { __( 'Cancel' ) }
243
213
  </Button>
@@ -249,46 +219,9 @@ export default function HTMLEditModal( {
249
219
  { __( 'Update' ) }
250
220
  </Button>
251
221
  </HStack>
252
- </Grid>
222
+ </VStack>
253
223
  </Tabs>
254
224
  </Modal>
255
-
256
- { showUnsavedWarning && (
257
- <Modal
258
- title={ __( 'Unsaved changes' ) }
259
- onRequestClose={ handleContinueEditing }
260
- size="medium"
261
- >
262
- <p>
263
- { __(
264
- 'You have unsaved changes. What would you like to do?'
265
- ) }
266
- </p>
267
- <Flex direction="row" justify="flex-end" gap={ 2 }>
268
- <Button
269
- __next40pxDefaultSize
270
- variant="secondary"
271
- onClick={ handleDiscardChanges }
272
- >
273
- { __( 'Discard unsaved changes' ) }
274
- </Button>
275
- <Button
276
- __next40pxDefaultSize
277
- variant="secondary"
278
- onClick={ handleContinueEditing }
279
- >
280
- { __( 'Continue editing' ) }
281
- </Button>
282
- <Button
283
- __next40pxDefaultSize
284
- variant="primary"
285
- onClick={ handleUpdateAndClose }
286
- >
287
- { __( 'Update and close' ) }
288
- </Button>
289
- </Flex>
290
- </Modal>
291
- ) }
292
225
  </>
293
226
  );
294
227
  }
@@ -59,19 +59,10 @@
59
59
  }
60
60
  },
61
61
  "selectors": {
62
- "root": ".wp-block-icon",
63
- "color": {
64
- "root": ".wp-block-icon svg"
65
- },
66
- "border": {
67
- "root": ".wp-block-icon svg"
68
- },
62
+ "root": ".wp-block-icon svg",
63
+ "css": ".wp-block-icon",
69
64
  "spacing": {
70
- "padding": ".wp-block-icon svg"
71
- },
72
- "dimensions": {
73
- "root": ".wp-block-icon svg",
74
- "width": ".wp-block-icon svg"
65
+ "margin": ".wp-block-icon"
75
66
  }
76
67
  },
77
68
  "style": "wp-block-icon",
@@ -1,6 +1,11 @@
1
1
  @use "@wordpress/base-styles/variables" as *;
2
2
  @use "@wordpress/base-styles/colors" as *;
3
3
 
4
+ .wp-block[data-align="center"] > .wp-block-icon {
5
+ display: flex;
6
+ justify-content: center;
7
+ }
8
+
4
9
  // Style for the icon library modal.
5
10
  .wp-block-icon__inserter {
6
11
  padding: 0 $grid-unit-30;
@@ -10,7 +10,9 @@
10
10
  *
11
11
  * @since 7.0.0
12
12
  *
13
- * @param array $attributes The block attributes.
13
+ * @param array $attributes The block attributes.
14
+ * @param string $content The block content.
15
+ * @param WP_Block $block The block instance.
14
16
  *
15
17
  * @return string Returns the Icon.
16
18
  */
@@ -1241,21 +1241,20 @@ export default function Image( {
1241
1241
  } );
1242
1242
  };
1243
1243
 
1244
- const featuredImageControl = (
1245
- <BlockSettingsMenuControls>
1246
- { ( { selectedClientIds } ) =>
1247
- selectedClientIds.length === 1 &&
1248
- ! isDescendentOfQueryLoop &&
1249
- postId &&
1250
- id &&
1251
- clientId === selectedClientIds[ 0 ] && (
1252
- <MenuItem onClick={ setPostFeatureImage }>
1253
- { __( 'Set as featured image' ) }
1254
- </MenuItem>
1255
- )
1256
- }
1257
- </BlockSettingsMenuControls>
1258
- );
1244
+ const featuredImageControl =
1245
+ ! isDescendentOfQueryLoop && postId && id ? (
1246
+ <BlockSettingsMenuControls>
1247
+ { ( { canEdit, selectedClientIds } ) =>
1248
+ canEdit &&
1249
+ selectedClientIds.length === 1 &&
1250
+ clientId === selectedClientIds[ 0 ] && (
1251
+ <MenuItem onClick={ setPostFeatureImage }>
1252
+ { __( 'Set as featured image' ) }
1253
+ </MenuItem>
1254
+ )
1255
+ }
1256
+ </BlockSettingsMenuControls>
1257
+ ) : null;
1259
1258
 
1260
1259
  return (
1261
1260
  <>
@@ -205,8 +205,8 @@ function block_core_image_render_lightbox( $block_content, $block, $block_instan
205
205
  array(
206
206
  'defaultAriaLabel' => __( 'Enlarged image' ),
207
207
  'closeButtonText' => esc_html__( 'Close' ),
208
- 'prevButtonText' => esc_html__( 'Previous' ),
209
- 'nextButtonText' => esc_html__( 'Next' ),
208
+ 'prevButtonText' => esc_html_x( 'Previous', 'previous image in lightbox' ),
209
+ 'nextButtonText' => esc_html_x( 'Next', 'next image in lightbox' ),
210
210
  )
211
211
  );
212
212
 
@@ -218,7 +218,9 @@ function block_core_image_render_lightbox( $block_content, $block, $block_instan
218
218
  if ( isset( $block['attrs']['id'] ) ) {
219
219
  $img_uploaded_src = wp_get_attachment_url( $block['attrs']['id'] );
220
220
  $img_metadata = wp_get_attachment_metadata( $block['attrs']['id'] );
221
- $img_srcset = wp_get_attachment_image_srcset( $block['attrs']['id'] );
221
+ $has_dimensions = ( $img_metadata['width'] ?? '' ) && ( $img_metadata['height'] ?? '' );
222
+ $srcset_size = $has_dimensions ? array( $img_metadata['width'], $img_metadata['height'] ) : 'large';
223
+ $img_srcset = wp_get_attachment_image_srcset( $block['attrs']['id'], $srcset_size );
222
224
  $img_width = $img_metadata['width'] ?? 'none';
223
225
  $img_height = $img_metadata['height'] ?? 'none';
224
226
  }
@@ -321,8 +323,8 @@ function block_core_image_render_lightbox( $block_content, $block, $block_instan
321
323
  function block_core_image_print_lightbox_overlay() {
322
324
  $dialog_label = esc_attr__( 'Enlarged images' );
323
325
  $close_button_text = esc_attr__( 'Close' );
324
- $prev_button_text = esc_attr__( 'Previous' );
325
- $next_button_text = esc_attr__( 'Next' );
326
+ $prev_button_text = esc_attr_x( 'Previous', 'previous image in lightbox' );
327
+ $next_button_text = esc_attr_x( 'Next', 'next image in lightbox' );
326
328
  $close_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="20" height="20" aria-hidden="true" focusable="false"><path d="m13.06 12 6.47-6.47-1.06-1.06L12 10.94 5.53 4.47 4.47 5.53 10.94 12l-6.47 6.47 1.06 1.06L12 13.06l6.47 6.47 1.06-1.06L13.06 12Z"></path></svg>';
327
329
  $prev_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28" height="28" aria-hidden="true" focusable="false"><path d="M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"></path></svg>';
328
330
  $next_button_icon = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="28" height="28" aria-hidden="true" focusable="false"><path d="M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"></path></svg>';
@@ -23,6 +23,39 @@ const v1 = {
23
23
  default: true,
24
24
  },
25
25
  },
26
+ supports: {
27
+ align: true,
28
+ color: {
29
+ gradients: true,
30
+ link: true,
31
+ __experimentalDefaultControls: {
32
+ background: true,
33
+ text: true,
34
+ link: true,
35
+ },
36
+ },
37
+ html: false,
38
+ spacing: {
39
+ margin: true,
40
+ padding: true,
41
+ },
42
+ typography: {
43
+ fontSize: true,
44
+ lineHeight: true,
45
+ __experimentalFontFamily: true,
46
+ __experimentalFontWeight: true,
47
+ __experimentalFontStyle: true,
48
+ __experimentalTextTransform: true,
49
+ __experimentalTextDecoration: true,
50
+ __experimentalLetterSpacing: true,
51
+ __experimentalDefaultControls: {
52
+ fontSize: true,
53
+ },
54
+ },
55
+ interactivity: {
56
+ clientNavigation: true,
57
+ },
58
+ },
26
59
  isEligible( attributes ) {
27
60
  return attributes?.displayExcerpt === false;
28
61
  },