@wordpress/block-library 9.42.0 → 9.43.1-next.v.202604091042.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 (153) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/code/edit.cjs +2 -1
  3. package/build/code/edit.cjs.map +2 -2
  4. package/build/cover/edit/color-utils.cjs +1 -1
  5. package/build/cover/edit/color-utils.cjs.map +2 -2
  6. package/build/cover/edit/index.cjs +31 -25
  7. package/build/cover/edit/index.cjs.map +2 -2
  8. package/build/cover/embed-video-utils.cjs +9 -7
  9. package/build/cover/embed-video-utils.cjs.map +2 -2
  10. package/build/file/utils/index.cjs +1 -1
  11. package/build/file/utils/index.cjs.map +2 -2
  12. package/build/form/view.cjs +1 -1
  13. package/build/form/view.cjs.map +2 -2
  14. package/build/form-input/edit.cjs +36 -29
  15. package/build/form-input/edit.cjs.map +2 -2
  16. package/build/form-input/variations.cjs +10 -0
  17. package/build/form-input/variations.cjs.map +2 -2
  18. package/build/group/block.json +3 -1
  19. package/build/icon/edit.cjs +1 -3
  20. package/build/icon/edit.cjs.map +2 -2
  21. package/build/image/image.cjs +17 -7
  22. package/build/image/image.cjs.map +2 -2
  23. package/build/latest-comments/deprecated.cjs +33 -0
  24. package/build/latest-comments/deprecated.cjs.map +2 -2
  25. package/build/list-item/block.json +1 -0
  26. package/build/navigation/edit/index.cjs +123 -119
  27. package/build/navigation/edit/index.cjs.map +3 -3
  28. package/build/navigation/edit/navigation-menu-selector.cjs +2 -1
  29. package/build/navigation/edit/navigation-menu-selector.cjs.map +2 -2
  30. package/build/navigation-link/link-ui/page-creator.cjs +1 -1
  31. package/build/navigation-link/link-ui/page-creator.cjs.map +2 -2
  32. package/build/navigation-link/shared/update-attributes.cjs +1 -1
  33. package/build/navigation-link/shared/update-attributes.cjs.map +2 -2
  34. package/build/navigation-link/shared/use-link-preview.cjs +1 -1
  35. package/build/navigation-link/shared/use-link-preview.cjs.map +2 -2
  36. package/build/pattern/edit.cjs +1 -1
  37. package/build/pattern/edit.cjs.map +2 -2
  38. package/build/search/block.json +0 -4
  39. package/build/search/edit.cjs +6 -33
  40. package/build/search/edit.cjs.map +2 -2
  41. package/build/site-logo/edit.cjs +19 -13
  42. package/build/site-logo/edit.cjs.map +3 -3
  43. package/build/site-tagline/deprecated.cjs +2 -1
  44. package/build/site-tagline/deprecated.cjs.map +2 -2
  45. package/build/tab/save.cjs +2 -4
  46. package/build/tab/save.cjs.map +2 -2
  47. package/build/tabs/save.cjs +2 -4
  48. package/build/tabs/save.cjs.map +2 -2
  49. package/build/utils/media-control.cjs +1 -1
  50. package/build/utils/media-control.cjs.map +2 -2
  51. package/build-module/code/edit.mjs +2 -1
  52. package/build-module/code/edit.mjs.map +2 -2
  53. package/build-module/cover/edit/color-utils.mjs +1 -1
  54. package/build-module/cover/edit/color-utils.mjs.map +2 -2
  55. package/build-module/cover/edit/index.mjs +39 -28
  56. package/build-module/cover/edit/index.mjs.map +2 -2
  57. package/build-module/cover/embed-video-utils.mjs +8 -6
  58. package/build-module/cover/embed-video-utils.mjs.map +2 -2
  59. package/build-module/file/utils/index.mjs +1 -1
  60. package/build-module/file/utils/index.mjs.map +2 -2
  61. package/build-module/form/view.mjs +1 -1
  62. package/build-module/form/view.mjs.map +2 -2
  63. package/build-module/form-input/edit.mjs +36 -29
  64. package/build-module/form-input/edit.mjs.map +2 -2
  65. package/build-module/form-input/variations.mjs +10 -0
  66. package/build-module/form-input/variations.mjs.map +2 -2
  67. package/build-module/group/block.json +3 -1
  68. package/build-module/icon/edit.mjs +1 -3
  69. package/build-module/icon/edit.mjs.map +2 -2
  70. package/build-module/image/image.mjs +17 -7
  71. package/build-module/image/image.mjs.map +2 -2
  72. package/build-module/latest-comments/deprecated.mjs +33 -0
  73. package/build-module/latest-comments/deprecated.mjs.map +2 -2
  74. package/build-module/list-item/block.json +1 -0
  75. package/build-module/navigation/edit/index.mjs +123 -119
  76. package/build-module/navigation/edit/index.mjs.map +2 -2
  77. package/build-module/navigation/edit/navigation-menu-selector.mjs +2 -1
  78. package/build-module/navigation/edit/navigation-menu-selector.mjs.map +2 -2
  79. package/build-module/navigation-link/link-ui/page-creator.mjs +1 -1
  80. package/build-module/navigation-link/link-ui/page-creator.mjs.map +2 -2
  81. package/build-module/navigation-link/shared/update-attributes.mjs +1 -1
  82. package/build-module/navigation-link/shared/update-attributes.mjs.map +2 -2
  83. package/build-module/navigation-link/shared/use-link-preview.mjs +1 -1
  84. package/build-module/navigation-link/shared/use-link-preview.mjs.map +2 -2
  85. package/build-module/pattern/edit.mjs +1 -1
  86. package/build-module/pattern/edit.mjs.map +2 -2
  87. package/build-module/search/block.json +0 -4
  88. package/build-module/search/edit.mjs +6 -33
  89. package/build-module/search/edit.mjs.map +2 -2
  90. package/build-module/site-logo/edit.mjs +21 -14
  91. package/build-module/site-logo/edit.mjs.map +2 -2
  92. package/build-module/site-tagline/deprecated.mjs +2 -1
  93. package/build-module/site-tagline/deprecated.mjs.map +2 -2
  94. package/build-module/tab/save.mjs +2 -4
  95. package/build-module/tab/save.mjs.map +2 -2
  96. package/build-module/tabs/save.mjs +2 -4
  97. package/build-module/tabs/save.mjs.map +2 -2
  98. package/build-module/utils/media-control.mjs +1 -1
  99. package/build-module/utils/media-control.mjs.map +2 -2
  100. package/build-style/code/style-rtl.css +1 -1
  101. package/build-style/code/style.css +1 -1
  102. package/build-style/editor-rtl.css +15 -5
  103. package/build-style/editor.css +15 -5
  104. package/build-style/form-input/editor-rtl.css +6 -5
  105. package/build-style/form-input/editor.css +6 -5
  106. package/build-style/icon/editor-rtl.css +5 -0
  107. package/build-style/icon/editor.css +5 -0
  108. package/build-style/image/editor-rtl.css +4 -0
  109. package/build-style/image/editor.css +4 -0
  110. package/build-style/navigation/style-rtl.css +4 -1
  111. package/build-style/navigation/style.css +4 -1
  112. package/build-style/style-rtl.css +5 -2
  113. package/build-style/style.css +5 -2
  114. package/package.json +38 -38
  115. package/src/code/edit.js +1 -0
  116. package/src/code/style.scss +1 -1
  117. package/src/cover/edit/color-utils.js +1 -1
  118. package/src/cover/edit/index.js +63 -34
  119. package/src/cover/embed-video-utils.js +10 -8
  120. package/src/embed/test/index.native.js +3 -2
  121. package/src/file/utils/index.js +1 -1
  122. package/src/form/view.js +1 -1
  123. package/src/form-input/edit.js +19 -15
  124. package/src/form-input/editor.scss +6 -6
  125. package/src/form-input/variations.js +10 -0
  126. package/src/group/block.json +3 -1
  127. package/src/home-link/index.php +14 -33
  128. package/src/icon/edit.js +1 -3
  129. package/src/icon/editor.scss +5 -0
  130. package/src/image/editor.scss +5 -0
  131. package/src/image/image.js +24 -7
  132. package/src/image/index.php +4 -4
  133. package/src/latest-comments/deprecated.js +33 -0
  134. package/src/list-item/block.json +1 -0
  135. package/src/loginout/index.php +13 -0
  136. package/src/navigation/edit/index.js +134 -130
  137. package/src/navigation/edit/navigation-menu-selector.js +2 -1
  138. package/src/navigation/style.scss +5 -3
  139. package/src/navigation-link/index.php +10 -38
  140. package/src/navigation-link/link-ui/page-creator.js +1 -1
  141. package/src/navigation-link/shared/build-css-font-sizes.php +43 -0
  142. package/src/navigation-link/shared/update-attributes.js +1 -1
  143. package/src/navigation-link/shared/use-link-preview.js +1 -1
  144. package/src/navigation-submenu/index.php +10 -38
  145. package/src/page-list/index.php +14 -41
  146. package/src/pattern/edit.js +1 -1
  147. package/src/search/block.json +0 -4
  148. package/src/search/edit.js +2 -35
  149. package/src/site-logo/edit.js +24 -13
  150. package/src/site-tagline/deprecated.js +1 -0
  151. package/src/tab/save.js +2 -6
  152. package/src/tabs/save.js +2 -6
  153. package/src/utils/media-control.js +3 -1
@@ -7,6 +7,7 @@
7
7
 
8
8
  require_once __DIR__ . '/navigation-link/shared/item-should-render.php';
9
9
  require_once __DIR__ . '/navigation-link/shared/render-submenu-icon.php';
10
+ require_once __DIR__ . '/navigation-link/shared/build-css-font-sizes.php';
10
11
 
11
12
  /**
12
13
  * Build an array with CSS classes and inline styles defining the colors
@@ -80,43 +81,6 @@ function block_core_navigation_link_build_css_colors( $context, $attributes, $is
80
81
  return $colors;
81
82
  }
82
83
 
83
- /**
84
- * Build an array with CSS classes and inline styles defining the font sizes
85
- * which will be applied to the navigation markup in the front-end.
86
- *
87
- * @since 5.9.0
88
- *
89
- * @param array $context Navigation block context.
90
- * @return array Font size CSS classes and inline styles.
91
- */
92
- function block_core_navigation_link_build_css_font_sizes( $context ) {
93
- // CSS classes.
94
- $font_sizes = array(
95
- 'css_classes' => array(),
96
- 'inline_styles' => '',
97
- );
98
-
99
- $has_named_font_size = array_key_exists( 'fontSize', $context );
100
- $has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
101
-
102
- if ( $has_named_font_size ) {
103
- // Add the font size class.
104
- $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
105
- } elseif ( $has_custom_font_size ) {
106
- // Add the custom font size inline style.
107
- $font_sizes['inline_styles'] = sprintf(
108
- 'font-size: %s;',
109
- wp_get_typography_font_size_value(
110
- array(
111
- 'size' => $context['style']['typography']['fontSize'],
112
- )
113
- )
114
- );
115
- }
116
-
117
- return $font_sizes;
118
- }
119
-
120
84
  /**
121
85
  * Decodes a url if it's encoded, returning the same url if not.
122
86
  *
@@ -174,7 +138,15 @@ function render_block_core_navigation_link( $attributes, $content, $block ) {
174
138
  return '';
175
139
  }
176
140
 
177
- $font_sizes = block_core_navigation_link_build_css_font_sizes( $block->context );
141
+ // The build system prefixes this function with "gutenberg_" to avoid
142
+ // collisions with the core version. Until this function is backported to
143
+ // core, we need to guard its use and only call the prefixed name in
144
+ // the plugin.
145
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
146
+ $font_sizes = gutenberg_block_core_shared_navigation_build_css_font_sizes( $block->context );
147
+ } else {
148
+ $font_sizes = block_core_shared_navigation_build_css_font_sizes( $block->context );
149
+ }
178
150
  $classes = array_merge(
179
151
  $font_sizes['css_classes']
180
152
  );
@@ -103,7 +103,7 @@ export function LinkUIPageCreator( {
103
103
 
104
104
  onPageCreated( pageLink );
105
105
  }
106
- } catch ( error ) {
106
+ } catch {
107
107
  // Show error notice
108
108
  createErrorNotice(
109
109
  __( 'Failed to create page. Please try again.' ),
@@ -0,0 +1,43 @@
1
+ <?php
2
+ /**
3
+ * Shared helper function for building CSS font sizes in navigation blocks.
4
+ *
5
+ * @package WordPress
6
+ */
7
+
8
+ /**
9
+ * Build an array with CSS classes and inline styles defining the font sizes
10
+ * which will be applied to the navigation markup in the front-end.
11
+ *
12
+ * @since 7.1.0
13
+ *
14
+ * @param array $context Navigation block context.
15
+ * @return array Font size CSS classes and inline styles.
16
+ */
17
+ function block_core_shared_navigation_build_css_font_sizes( $context ) {
18
+ // CSS classes.
19
+ $font_sizes = array(
20
+ 'css_classes' => array(),
21
+ 'inline_styles' => '',
22
+ );
23
+
24
+ $has_named_font_size = array_key_exists( 'fontSize', $context );
25
+ $has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
26
+
27
+ if ( $has_named_font_size ) {
28
+ // Add the font size class.
29
+ $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
30
+ } elseif ( $has_custom_font_size ) {
31
+ // Add the custom font size inline style.
32
+ $font_sizes['inline_styles'] = sprintf(
33
+ 'font-size: %s;',
34
+ wp_get_typography_font_size_value(
35
+ array(
36
+ 'size' => $context['style']['typography']['fontSize'],
37
+ )
38
+ )
39
+ );
40
+ }
41
+
42
+ return $font_sizes;
43
+ }
@@ -34,7 +34,7 @@ const shouldSeverEntityLink = ( originalUrl, newUrl ) => {
34
34
  ? window.location.origin
35
35
  : 'https://wordpress.org' );
36
36
  return new URL( url, base );
37
- } catch ( error ) {
37
+ } catch {
38
38
  // If URL construction still fails, it's likely an invalid URL
39
39
  // and we should sever the entity link
40
40
  return null;
@@ -101,7 +101,7 @@ export function computeDisplayUrl( { linkUrl, homeUrl } = {} ) {
101
101
  // Different host - this is an external link
102
102
  isExternal = true;
103
103
  }
104
- } catch ( e ) {
104
+ } catch {
105
105
  // URL parsing failed - treat as external (e.g. no homeUrl, or URL without protocol)
106
106
  isExternal = true;
107
107
  }
@@ -7,6 +7,7 @@
7
7
 
8
8
  require_once __DIR__ . '/navigation-link/shared/item-should-render.php';
9
9
  require_once __DIR__ . '/navigation-link/shared/render-submenu-icon.php';
10
+ require_once __DIR__ . '/navigation-link/shared/build-css-font-sizes.php';
10
11
 
11
12
  /**
12
13
  * Returns the submenu visibility value with backward compatibility
@@ -49,43 +50,6 @@ function block_core_navigation_submenu_get_submenu_visibility( $context ) {
49
50
  return $submenu_visibility ?? 'hover';
50
51
  }
51
52
 
52
- /**
53
- * Build an array with CSS classes and inline styles defining the font sizes
54
- * which will be applied to the navigation markup in the front-end.
55
- *
56
- * @since 5.9.0
57
- *
58
- * @param array $context Navigation block context.
59
- * @return array Font size CSS classes and inline styles.
60
- */
61
- function block_core_navigation_submenu_build_css_font_sizes( $context ) {
62
- // CSS classes.
63
- $font_sizes = array(
64
- 'css_classes' => array(),
65
- 'inline_styles' => '',
66
- );
67
-
68
- $has_named_font_size = array_key_exists( 'fontSize', $context );
69
- $has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
70
-
71
- if ( $has_named_font_size ) {
72
- // Add the font size class.
73
- $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
74
- } elseif ( $has_custom_font_size ) {
75
- // Add the custom font size inline style.
76
- $font_sizes['inline_styles'] = sprintf(
77
- 'font-size: %s;',
78
- wp_get_typography_font_size_value(
79
- array(
80
- 'size' => $context['style']['typography']['fontSize'],
81
- )
82
- )
83
- );
84
- }
85
-
86
- return $font_sizes;
87
- }
88
-
89
53
  /**
90
54
  * Renders the `core/navigation-submenu` block.
91
55
  *
@@ -110,7 +74,15 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
110
74
  return '';
111
75
  }
112
76
 
113
- $font_sizes = block_core_navigation_submenu_build_css_font_sizes( $block->context );
77
+ // The build system prefixes this function with "gutenberg_" to avoid
78
+ // collisions with the core version. Until this function is backported to
79
+ // core, we need to guard its use and only call the prefixed name in
80
+ // the plugin.
81
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
82
+ $font_sizes = gutenberg_block_core_shared_navigation_build_css_font_sizes( $block->context );
83
+ } else {
84
+ $font_sizes = block_core_shared_navigation_build_css_font_sizes( $block->context );
85
+ }
114
86
  $style_attribute = $font_sizes['inline_styles'];
115
87
 
116
88
  // Render inner blocks first to check if any menu items will actually display.
@@ -5,6 +5,8 @@
5
5
  * @package WordPress
6
6
  */
7
7
 
8
+ require_once __DIR__ . '/navigation-link/shared/build-css-font-sizes.php';
9
+
8
10
  /**
9
11
  * Returns the submenu visibility value with backward compatibility
10
12
  * for the deprecated openSubmenusOnClick attribute.
@@ -123,44 +125,6 @@ function block_core_page_list_build_css_colors( $attributes, $context ) {
123
125
 
124
126
  return $colors;
125
127
  }
126
-
127
- /**
128
- * Build an array with CSS classes and inline styles defining the font sizes
129
- * which will be applied to the pages markup in the front-end when it is a descendant of navigation.
130
- *
131
- * @since 5.8.0
132
- *
133
- * @param array $context Navigation block context.
134
- * @return array Font size CSS classes and inline styles.
135
- */
136
- function block_core_page_list_build_css_font_sizes( $context ) {
137
- // CSS classes.
138
- $font_sizes = array(
139
- 'css_classes' => array(),
140
- 'inline_styles' => '',
141
- );
142
-
143
- $has_named_font_size = array_key_exists( 'fontSize', $context );
144
- $has_custom_font_size = isset( $context['style']['typography']['fontSize'] );
145
-
146
- if ( $has_named_font_size ) {
147
- // Add the font size class.
148
- $font_sizes['css_classes'][] = sprintf( 'has-%s-font-size', $context['fontSize'] );
149
- } elseif ( $has_custom_font_size ) {
150
- // Add the custom font size inline style.
151
- $font_sizes['inline_styles'] = sprintf(
152
- 'font-size: %s;',
153
- wp_get_typography_font_size_value(
154
- array(
155
- 'size' => $context['style']['typography']['fontSize'],
156
- )
157
- )
158
- );
159
- }
160
-
161
- return $font_sizes;
162
- }
163
-
164
128
  /**
165
129
  * Outputs Page list markup from an array of pages with nested children.
166
130
  *
@@ -342,12 +306,21 @@ function render_block_core_page_list( $attributes, $content, $block ) {
342
306
  }
343
307
  }
344
308
 
345
- $colors = block_core_page_list_build_css_colors( $attributes, $block->context );
346
- $font_sizes = block_core_page_list_build_css_font_sizes( $block->context );
347
- $classes = array_merge(
309
+ $colors = block_core_page_list_build_css_colors( $attributes, $block->context );
310
+ // The build system prefixes this function with "gutenberg_" to avoid
311
+ // collisions with the core version. Until this function is backported to
312
+ // core, we need to guard its use and only call the prefixed name in
313
+ // the plugin.
314
+ if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
315
+ $font_sizes = gutenberg_block_core_shared_navigation_build_css_font_sizes( $block->context );
316
+ } else {
317
+ $font_sizes = block_core_shared_navigation_build_css_font_sizes( $block->context );
318
+ }
319
+ $classes = array_merge(
348
320
  $colors['css_classes'],
349
321
  $font_sizes['css_classes']
350
322
  );
323
+
351
324
  $style_attribute = ( $colors['inline_styles'] . $font_sizes['inline_styles'] );
352
325
  $css_classes = trim( implode( ' ', $classes ) );
353
326
 
@@ -78,7 +78,7 @@ const PatternEdit = ( { attributes, clientId } ) => {
78
78
  if ( ! hasRecursionError && selectedPattern?.blocks ) {
79
79
  try {
80
80
  parsePatternDependencies( selectedPattern );
81
- } catch ( error ) {
81
+ } catch {
82
82
  setHasRecursionError( true );
83
83
  return;
84
84
  }
@@ -42,10 +42,6 @@
42
42
  "query": {
43
43
  "type": "object",
44
44
  "default": {}
45
- },
46
- "isSearchFieldHidden": {
47
- "type": "boolean",
48
- "default": false
49
45
  }
50
46
  },
51
47
  "supports": {
@@ -70,7 +70,6 @@ export default function SearchEdit( {
70
70
  buttonText,
71
71
  buttonPosition,
72
72
  buttonUseIcon,
73
- isSearchFieldHidden,
74
73
  style,
75
74
  } = attributes;
76
75
 
@@ -139,6 +138,7 @@ export default function SearchEdit( {
139
138
  const isButtonPositionOutside = 'button-outside' === buttonPosition;
140
139
  const hasNoButton = 'no-button' === buttonPosition;
141
140
  const hasOnlyButton = 'button-only' === buttonPosition;
141
+ const isSearchFieldHidden = hasOnlyButton && ! isSelected;
142
142
  const searchFieldRef = useRef();
143
143
  const buttonRef = useRef();
144
144
 
@@ -147,25 +147,6 @@ export default function SearchEdit( {
147
147
  defaultValues: { '%': PC_WIDTH_DEFAULT, px: PX_WIDTH_DEFAULT },
148
148
  } );
149
149
 
150
- useEffect( () => {
151
- if ( hasOnlyButton && ! isSelected ) {
152
- setAttributes( {
153
- isSearchFieldHidden: true,
154
- } );
155
- }
156
- }, [ hasOnlyButton, isSelected, setAttributes ] );
157
-
158
- // Show the search field when width changes.
159
- useEffect( () => {
160
- if ( ! hasOnlyButton || ! isSelected ) {
161
- return;
162
- }
163
-
164
- setAttributes( {
165
- isSearchFieldHidden: false,
166
- } );
167
- }, [ hasOnlyButton, isSelected, setAttributes, width ] );
168
-
169
150
  const getBlockClassNames = () => {
170
151
  return clsx(
171
152
  className,
@@ -183,7 +164,7 @@ export default function SearchEdit( {
183
164
  buttonUseIcon && ! hasNoButton
184
165
  ? 'wp-block-search__icon-button'
185
166
  : undefined,
186
- hasOnlyButton && isSearchFieldHidden
167
+ isSearchFieldHidden
187
168
  ? 'wp-block-search__searchfield-hidden'
188
169
  : undefined
189
170
  );
@@ -292,14 +273,6 @@ export default function SearchEdit( {
292
273
  }
293
274
  : borderProps.style ),
294
275
  };
295
- const handleButtonClick = () => {
296
- if ( hasOnlyButton ) {
297
- setAttributes( {
298
- isSearchFieldHidden: ! isSearchFieldHidden,
299
- } );
300
- }
301
- };
302
-
303
276
  return (
304
277
  <>
305
278
  { buttonUseIcon && (
@@ -312,7 +285,6 @@ export default function SearchEdit( {
312
285
  ? stripHTML( buttonText )
313
286
  : __( 'Search' )
314
287
  }
315
- onClick={ handleButtonClick }
316
288
  ref={ buttonRef }
317
289
  >
318
290
  <Icon icon={ search } />
@@ -331,7 +303,6 @@ export default function SearchEdit( {
331
303
  onChange={ ( html ) =>
332
304
  setAttributes( { buttonText: html } )
333
305
  }
334
- onClick={ handleButtonClick }
335
306
  />
336
307
  ) }
337
308
  </>
@@ -351,7 +322,6 @@ export default function SearchEdit( {
351
322
  showLabel: true,
352
323
  buttonUseIcon: false,
353
324
  buttonPosition: 'button-outside',
354
- isSearchFieldHidden: false,
355
325
  } );
356
326
  } }
357
327
  dropdownMenuProps={ dropdownMenuProps }
@@ -382,7 +352,6 @@ export default function SearchEdit( {
382
352
  onDeselect={ () => {
383
353
  setAttributes( {
384
354
  buttonPosition: 'button-outside',
385
- isSearchFieldHidden: false,
386
355
  } );
387
356
  } }
388
357
  isShownByDefault
@@ -394,8 +363,6 @@ export default function SearchEdit( {
394
363
  onChange={ ( value ) => {
395
364
  setAttributes( {
396
365
  buttonPosition: value,
397
- isSearchFieldHidden:
398
- value === 'button-only',
399
366
  } );
400
367
  } }
401
368
  options={ buttonPositionControls }
@@ -35,6 +35,7 @@ import {
35
35
  store as blockEditorStore,
36
36
  __experimentalImageEditor as ImageEditor,
37
37
  useBlockEditingMode,
38
+ privateApis as blockEditorPrivateApis,
38
39
  } from '@wordpress/block-editor';
39
40
  import { useSelect, useDispatch } from '@wordpress/data';
40
41
  import { store as coreStore } from '@wordpress/core-data';
@@ -46,9 +47,11 @@ import { store as noticesStore } from '@wordpress/notices';
46
47
  */
47
48
  import { MIN_SIZE } from '../image/constants';
48
49
  import { MediaControl, MediaControlPreview } from '../utils/media-control';
50
+ import { unlock } from '../lock-unlock';
49
51
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
50
52
 
51
53
  const ALLOWED_MEDIA_TYPES = [ 'image' ];
54
+ const { mediaEditKey } = unlock( blockEditorPrivateApis );
52
55
 
53
56
  const SiteLogo = ( {
54
57
  alt,
@@ -75,18 +78,22 @@ const SiteLogo = ( {
75
78
  const blockEditingMode = useBlockEditingMode();
76
79
  const isContentOnlyMode = blockEditingMode === 'contentOnly';
77
80
 
78
- const { imageEditing, maxWidth, title } = useSelect( ( select ) => {
79
- const settings = select( blockEditorStore ).getSettings();
80
- const siteEntities = select( coreStore ).getEntityRecord(
81
- 'root',
82
- '__unstableBase'
83
- );
84
- return {
85
- title: siteEntities?.name,
86
- imageEditing: settings.imageEditing,
87
- maxWidth: settings.maxWidth,
88
- };
89
- }, [] );
81
+ const { imageEditing, maxWidth, title, editMediaEntity } = useSelect(
82
+ ( select ) => {
83
+ const settings = select( blockEditorStore ).getSettings();
84
+ const siteEntities = select( coreStore ).getEntityRecord(
85
+ 'root',
86
+ '__unstableBase'
87
+ );
88
+ return {
89
+ title: siteEntities?.name,
90
+ imageEditing: settings.imageEditing,
91
+ maxWidth: settings.maxWidth,
92
+ editMediaEntity: settings?.[ mediaEditKey ],
93
+ };
94
+ },
95
+ []
96
+ );
90
97
 
91
98
  useEffect( () => {
92
99
  // Turn the `Use as site icon` toggle off if it is on but the logo and icon have
@@ -200,7 +207,11 @@ const SiteLogo = ( {
200
207
  /* eslint-enable no-lonely-if */
201
208
 
202
209
  const canEditImage =
203
- logoId && naturalWidth && naturalHeight && imageEditing;
210
+ logoId &&
211
+ naturalWidth &&
212
+ naturalHeight &&
213
+ imageEditing &&
214
+ !! editMediaEntity;
204
215
 
205
216
  // Hide crop and dimensions editing in write mode
206
217
  const shouldShowCropAndDimensions = ! isContentOnlyMode;
@@ -11,6 +11,7 @@ const v2 = {
11
11
  },
12
12
  level: {
13
13
  type: 'number',
14
+ default: 0,
14
15
  },
15
16
  levelOptions: {
16
17
  type: 'array',
package/src/tab/save.js CHANGED
@@ -3,15 +3,11 @@
3
3
  */
4
4
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
5
5
 
6
- export default function save( { attributes } ) {
7
- const { anchor } = attributes;
8
-
9
- const tabPanelId = anchor;
10
-
6
+ export default function save() {
11
7
  const blockProps = useBlockProps.save( {
12
8
  role: 'tabpanel',
13
9
  } );
14
10
  const innerBlocksProps = useInnerBlocksProps.save( blockProps );
15
11
 
16
- return <section { ...innerBlocksProps } id={ tabPanelId } />;
12
+ return <section { ...innerBlocksProps } />;
17
13
  }
package/src/tabs/save.js CHANGED
@@ -3,13 +3,9 @@
3
3
  */
4
4
  import { useBlockProps, useInnerBlocksProps } from '@wordpress/block-editor';
5
5
 
6
- export default function save( { attributes } ) {
7
- const { anchor } = attributes;
8
-
9
- const tabsId = anchor;
10
-
6
+ export default function save() {
11
7
  const blockProps = useBlockProps.save();
12
8
  const innerBlocksProps = useInnerBlocksProps.save( blockProps );
13
9
 
14
- return <div { ...innerBlocksProps } id={ tabsId } />;
10
+ return <div { ...innerBlocksProps } />;
15
11
  }
@@ -140,7 +140,9 @@ export function MediaControl( {
140
140
  filename={ filename }
141
141
  className="block-library-utils__media-control__inspector-media-replace-title"
142
142
  label={
143
- mediaUrl ? getFilename( filename ) : emptyLabel
143
+ mediaUrl
144
+ ? getFilename( filename ) || emptyLabel
145
+ : emptyLabel
144
146
  }
145
147
  />
146
148
  }