@wordpress/block-library 9.10.0 → 9.11.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 (206) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/README.md +10 -5
  3. package/build/archives/index.js +6 -0
  4. package/build/archives/index.js.map +1 -1
  5. package/build/avatar/hooks.js +2 -3
  6. package/build/avatar/hooks.js.map +1 -1
  7. package/build/button/get-updated-link-attributes.js +1 -1
  8. package/build/button/get-updated-link-attributes.js.map +1 -1
  9. package/build/comments/index.js +12 -0
  10. package/build/comments/index.js.map +1 -1
  11. package/build/cover/constants.js +8 -0
  12. package/build/cover/constants.js.map +1 -0
  13. package/build/cover/edit/index.js +24 -3
  14. package/build/cover/edit/index.js.map +1 -1
  15. package/build/cover/edit/inspector-controls.js +40 -2
  16. package/build/cover/edit/inspector-controls.js.map +1 -1
  17. package/build/cover/index.js +3 -0
  18. package/build/cover/index.js.map +1 -1
  19. package/build/cover/save.js +3 -1
  20. package/build/cover/save.js.map +1 -1
  21. package/build/file/edit.js +1 -2
  22. package/build/file/edit.js.map +1 -1
  23. package/build/gallery/constants.js +2 -1
  24. package/build/gallery/constants.js.map +1 -1
  25. package/build/gallery/edit.js +11 -2
  26. package/build/gallery/edit.js.map +1 -1
  27. package/build/gallery/utils.js +26 -5
  28. package/build/gallery/utils.js.map +1 -1
  29. package/build/html/edit.js +5 -1
  30. package/build/html/edit.js.map +1 -1
  31. package/build/html/preview.js +2 -2
  32. package/build/html/preview.js.map +1 -1
  33. package/build/latest-posts/edit.js +3 -8
  34. package/build/latest-posts/edit.js.map +1 -1
  35. package/build/navigation/edit/index.js +23 -2
  36. package/build/navigation/edit/index.js.map +1 -1
  37. package/build/navigation/edit/menu-inspector-controls.js +1 -1
  38. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  39. package/build/navigation/edit/navigation-menu-selector.js +2 -2
  40. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  41. package/build/paragraph/edit.js +1 -1
  42. package/build/paragraph/edit.js.map +1 -1
  43. package/build/post-featured-image/edit.js +1 -1
  44. package/build/post-featured-image/edit.js.map +1 -1
  45. package/build/post-time-to-read/edit.js +2 -2
  46. package/build/post-time-to-read/edit.js.map +1 -1
  47. package/build/query/edit/inspector-controls/order-control.js +2 -2
  48. package/build/query/edit/inspector-controls/order-control.js.map +1 -1
  49. package/build/query-title/edit.js +1 -1
  50. package/build/query-title/edit.js.map +1 -1
  51. package/build/search/edit.js +19 -14
  52. package/build/search/edit.js.map +1 -1
  53. package/build/separator/transforms.js +12 -0
  54. package/build/separator/transforms.js.map +1 -1
  55. package/build/social-links/edit.js +0 -1
  56. package/build/social-links/edit.js.map +1 -1
  57. package/build/spacer/index.js +2 -0
  58. package/build/spacer/index.js.map +1 -1
  59. package/build/spacer/transforms.js +27 -0
  60. package/build/spacer/transforms.js.map +1 -0
  61. package/build/table/edit.js +0 -1
  62. package/build/table/edit.js.map +1 -1
  63. package/build/table-of-contents/edit.js +2 -7
  64. package/build/table-of-contents/edit.js.map +1 -1
  65. package/build/template-part/edit/index.js +1 -1
  66. package/build/template-part/edit/index.js.map +1 -1
  67. package/build/video/tracks-editor.js +1 -1
  68. package/build/video/tracks-editor.js.map +1 -1
  69. package/build-module/archives/index.js +6 -0
  70. package/build-module/archives/index.js.map +1 -1
  71. package/build-module/avatar/hooks.js +2 -3
  72. package/build-module/avatar/hooks.js.map +1 -1
  73. package/build-module/button/get-updated-link-attributes.js +1 -1
  74. package/build-module/button/get-updated-link-attributes.js.map +1 -1
  75. package/build-module/comments/index.js +12 -0
  76. package/build-module/comments/index.js.map +1 -1
  77. package/build-module/cover/constants.js +2 -0
  78. package/build-module/cover/constants.js.map +1 -0
  79. package/build-module/cover/edit/index.js +24 -3
  80. package/build-module/cover/edit/index.js.map +1 -1
  81. package/build-module/cover/edit/inspector-controls.js +41 -3
  82. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  83. package/build-module/cover/index.js +3 -0
  84. package/build-module/cover/index.js.map +1 -1
  85. package/build-module/cover/save.js +3 -1
  86. package/build-module/cover/save.js.map +1 -1
  87. package/build-module/file/edit.js +1 -2
  88. package/build-module/file/edit.js.map +1 -1
  89. package/build-module/gallery/constants.js +1 -0
  90. package/build-module/gallery/constants.js.map +1 -1
  91. package/build-module/gallery/edit.js +14 -5
  92. package/build-module/gallery/edit.js.map +1 -1
  93. package/build-module/gallery/utils.js +27 -6
  94. package/build-module/gallery/utils.js.map +1 -1
  95. package/build-module/html/edit.js +6 -2
  96. package/build-module/html/edit.js.map +1 -1
  97. package/build-module/html/preview.js +2 -2
  98. package/build-module/html/preview.js.map +1 -1
  99. package/build-module/latest-posts/edit.js +3 -8
  100. package/build-module/latest-posts/edit.js.map +1 -1
  101. package/build-module/navigation/edit/index.js +23 -2
  102. package/build-module/navigation/edit/index.js.map +1 -1
  103. package/build-module/navigation/edit/menu-inspector-controls.js +1 -3
  104. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  105. package/build-module/navigation/edit/navigation-menu-selector.js +2 -2
  106. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  107. package/build-module/paragraph/edit.js +1 -1
  108. package/build-module/paragraph/edit.js.map +1 -1
  109. package/build-module/post-featured-image/edit.js +1 -1
  110. package/build-module/post-featured-image/edit.js.map +1 -1
  111. package/build-module/post-time-to-read/edit.js +2 -2
  112. package/build-module/post-time-to-read/edit.js.map +1 -1
  113. package/build-module/query/edit/inspector-controls/order-control.js +2 -2
  114. package/build-module/query/edit/inspector-controls/order-control.js.map +1 -1
  115. package/build-module/query-title/edit.js +2 -2
  116. package/build-module/query-title/edit.js.map +1 -1
  117. package/build-module/search/edit.js +20 -15
  118. package/build-module/search/edit.js.map +1 -1
  119. package/build-module/separator/transforms.js +12 -0
  120. package/build-module/separator/transforms.js.map +1 -1
  121. package/build-module/social-links/edit.js +0 -1
  122. package/build-module/social-links/edit.js.map +1 -1
  123. package/build-module/spacer/index.js +2 -0
  124. package/build-module/spacer/index.js.map +1 -1
  125. package/build-module/spacer/transforms.js +20 -0
  126. package/build-module/spacer/transforms.js.map +1 -0
  127. package/build-module/table/edit.js +0 -1
  128. package/build-module/table/edit.js.map +1 -1
  129. package/build-module/table-of-contents/edit.js +2 -7
  130. package/build-module/table-of-contents/edit.js.map +1 -1
  131. package/build-module/template-part/edit/index.js +1 -1
  132. package/build-module/template-part/edit/index.js.map +1 -1
  133. package/build-module/video/tracks-editor.js +2 -2
  134. package/build-module/video/tracks-editor.js.map +1 -1
  135. package/build-style/archives/editor-rtl.css +5 -0
  136. package/build-style/archives/editor.css +5 -0
  137. package/build-style/button/style-rtl.css +3 -0
  138. package/build-style/button/style.css +3 -0
  139. package/build-style/comments/editor-rtl.css +4 -0
  140. package/build-style/comments/editor.css +4 -0
  141. package/build-style/comments/style-rtl.css +4 -0
  142. package/build-style/comments/style.css +4 -0
  143. package/build-style/cover/style-rtl.css +5 -0
  144. package/build-style/cover/style.css +5 -0
  145. package/build-style/editor-rtl.css +20 -0
  146. package/build-style/editor.css +20 -0
  147. package/build-style/group/editor-rtl.css +10 -0
  148. package/build-style/group/editor.css +10 -0
  149. package/build-style/image/style-rtl.css +2 -0
  150. package/build-style/image/style.css +2 -0
  151. package/build-style/navigation/editor-rtl.css +1 -0
  152. package/build-style/navigation/editor.css +1 -0
  153. package/build-style/style-rtl.css +14 -0
  154. package/build-style/style.css +14 -0
  155. package/package.json +36 -35
  156. package/src/archives/block.json +6 -0
  157. package/src/archives/editor.scss +8 -0
  158. package/src/avatar/hooks.js +2 -3
  159. package/src/avatar/index.php +4 -5
  160. package/src/button/get-updated-link-attributes.js +1 -1
  161. package/src/button/style.scss +3 -0
  162. package/src/button/test/get-updated-link-attributes.js +15 -0
  163. package/src/comment-author-avatar/index.php +1 -1
  164. package/src/comments/block.json +21 -3
  165. package/src/comments/style.scss +4 -1
  166. package/src/cover/block.json +3 -0
  167. package/src/cover/constants.js +1 -0
  168. package/src/cover/edit/index.js +20 -2
  169. package/src/cover/edit/inspector-controls.js +46 -1
  170. package/src/cover/save.js +2 -0
  171. package/src/cover/style.scss +6 -0
  172. package/src/cover/test/edit.js +1 -3
  173. package/src/file/edit.js +1 -2
  174. package/src/gallery/constants.js +1 -0
  175. package/src/gallery/edit.js +25 -2
  176. package/src/gallery/utils.js +23 -2
  177. package/src/group/editor.scss +12 -0
  178. package/src/html/edit.js +7 -1
  179. package/src/html/preview.js +3 -2
  180. package/src/image/style.scss +1 -0
  181. package/src/latest-posts/edit.js +3 -7
  182. package/src/latest-posts/index.php +1 -1
  183. package/src/navigation/edit/index.js +30 -3
  184. package/src/navigation/edit/menu-inspector-controls.js +2 -2
  185. package/src/navigation/edit/navigation-menu-selector.js +2 -2
  186. package/src/navigation/editor.scss +1 -0
  187. package/src/paragraph/edit.js +1 -1
  188. package/src/post-featured-image/edit.js +1 -1
  189. package/src/post-time-to-read/edit.js +2 -2
  190. package/src/post-time-to-read/index.php +1 -1
  191. package/src/query/edit/inspector-controls/order-control.js +2 -2
  192. package/src/query-title/edit.js +2 -2
  193. package/src/rss/index.php +1 -1
  194. package/src/search/edit.js +28 -25
  195. package/src/separator/test/__snapshots__/transforms.native.js.snap +6 -0
  196. package/src/separator/test/transforms.native.js +1 -1
  197. package/src/separator/transforms.js +11 -0
  198. package/src/social-links/edit.js +0 -1
  199. package/src/spacer/index.js +2 -0
  200. package/src/spacer/test/__snapshots__/transforms.native.js.snap +6 -0
  201. package/src/spacer/test/transforms.native.js +1 -1
  202. package/src/spacer/transforms.js +20 -0
  203. package/src/table/edit.js +0 -1
  204. package/src/table-of-contents/edit.js +2 -6
  205. package/src/template-part/edit/index.js +1 -1
  206. package/src/video/tracks-editor.js +2 -2
@@ -10,6 +10,18 @@
10
10
  }
11
11
  }
12
12
 
13
+ // Reset user select, but the next rule should take precedence for nested
14
+ // groups.
15
+ :where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group > *) {
16
+ user-select: initial;
17
+ }
18
+
19
+ // When we are not multi-selecting, prevent children from capturing the
20
+ // selection, which happens when the group is flex and children inlined.
21
+ :where([data-has-multi-selection]:not([contenteditable="true"]) .wp-block-group) {
22
+ user-select: none;
23
+ }
24
+
13
25
  // Place block list appender in the same place content will appear.
14
26
  [data-type="core/group"].is-selected {
15
27
  .block-list-appender {
package/src/html/edit.js CHANGED
@@ -7,6 +7,7 @@ import {
7
7
  BlockControls,
8
8
  PlainText,
9
9
  useBlockProps,
10
+ store as blockEditorStore,
10
11
  } from '@wordpress/block-editor';
11
12
  import {
12
13
  ToolbarButton,
@@ -14,6 +15,7 @@ import {
14
15
  ToolbarGroup,
15
16
  VisuallyHidden,
16
17
  } from '@wordpress/components';
18
+ import { useSelect } from '@wordpress/data';
17
19
  import { useInstanceId } from '@wordpress/compose';
18
20
 
19
21
  /**
@@ -27,6 +29,10 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
27
29
 
28
30
  const instanceId = useInstanceId( HTMLEdit, 'html-edit-desc' );
29
31
 
32
+ const isPreviewMode = useSelect( ( select ) => {
33
+ return select( blockEditorStore ).getSettings().isPreviewMode;
34
+ }, [] );
35
+
30
36
  function switchToPreview() {
31
37
  setIsPreview( true );
32
38
  }
@@ -58,7 +64,7 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) {
58
64
  </ToolbarButton>
59
65
  </ToolbarGroup>
60
66
  </BlockControls>
61
- { isPreview || isDisabled ? (
67
+ { isPreview || isPreviewMode || isDisabled ? (
62
68
  <>
63
69
  <Preview
64
70
  content={ attributes.content }
@@ -23,14 +23,15 @@ const DEFAULT_STYLES = `
23
23
 
24
24
  export default function HTMLEditPreview( { content, isSelected } ) {
25
25
  const settingStyles = useSelect(
26
- ( select ) => select( blockEditorStore ).getSettings().styles
26
+ ( select ) => select( blockEditorStore ).getSettings().styles,
27
+ []
27
28
  );
28
29
 
29
30
  const styles = useMemo(
30
31
  () => [
31
32
  DEFAULT_STYLES,
32
33
  ...transformStyles(
33
- settingStyles.filter( ( style ) => style.css )
34
+ ( settingStyles ?? [] ).filter( ( style ) => style.css )
34
35
  ),
35
36
  ],
36
37
  [ settingStyles ]
@@ -9,6 +9,7 @@
9
9
  max-width: 100%;
10
10
  vertical-align: bottom;
11
11
  box-sizing: border-box;
12
+ width: fit-content;
12
13
 
13
14
  @media (prefers-reduced-motion: no-preference) {
14
15
  &.hide {
@@ -155,15 +155,11 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
155
155
  );
156
156
 
157
157
  // If a user clicks to a link prevent redirection and show a warning.
158
- const { createWarningNotice, removeNotice } = useDispatch( noticeStore );
159
- let noticeId;
158
+ const { createWarningNotice } = useDispatch( noticeStore );
160
159
  const showRedirectionPreventedNotice = ( event ) => {
161
160
  event.preventDefault();
162
- // Remove previous warning if any, to show one at a time per block.
163
- removeNotice( noticeId );
164
- noticeId = `block-library/core/latest-posts/redirection-prevented/${ instanceId }`;
165
161
  createWarningNotice( __( 'Links are disabled in the editor.' ), {
166
- id: noticeId,
162
+ id: `block-library/core/latest-posts/redirection-prevented/${ instanceId }`,
167
163
  type: 'snackbar',
168
164
  } );
169
165
  };
@@ -593,7 +589,7 @@ export default function LatestPostsEdit( { attributes, setAttributes } ) {
593
589
  { displayAuthor && currentAuthor && (
594
590
  <div className="wp-block-latest-posts__post-author">
595
591
  { sprintf(
596
- /* translators: byline. %s: current author. */
592
+ /* translators: byline. %s: author. */
597
593
  __( 'by %s' ),
598
594
  currentAuthor.name
599
595
  ) }
@@ -123,7 +123,7 @@ function render_block_core_latest_posts( $attributes ) {
123
123
  if ( isset( $attributes['displayAuthor'] ) && $attributes['displayAuthor'] ) {
124
124
  $author_display_name = get_the_author_meta( 'display_name', $post->post_author );
125
125
 
126
- /* translators: byline. %s: current author. */
126
+ /* translators: byline. %s: author. */
127
127
  $byline = sprintf( __( 'by %s' ), $author_display_name );
128
128
 
129
129
  if ( ! empty( $author_display_name ) ) {
@@ -73,6 +73,33 @@ import AccessibleDescription from './accessible-description';
73
73
  import AccessibleMenuDescription from './accessible-menu-description';
74
74
  import { unlock } from '../../lock-unlock';
75
75
 
76
+ function useResponsiveMenu( navRef ) {
77
+ const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
78
+ useState( false );
79
+
80
+ useEffect( () => {
81
+ if ( ! navRef.current ) {
82
+ return;
83
+ }
84
+
85
+ const htmlElement = navRef.current.ownerDocument.documentElement;
86
+
87
+ // Add a `has-modal-open` class to the <html> when the responsive
88
+ // menu is open. This reproduces the same behavior of the frontend.
89
+ if ( isResponsiveMenuOpen ) {
90
+ htmlElement.classList.add( 'has-modal-open' );
91
+ } else {
92
+ htmlElement.classList.remove( 'has-modal-open' );
93
+ }
94
+
95
+ return () => {
96
+ htmlElement?.classList.remove( 'has-modal-open' );
97
+ };
98
+ }, [ navRef, isResponsiveMenuOpen ] );
99
+
100
+ return [ isResponsiveMenuOpen, setResponsiveMenuVisibility ];
101
+ }
102
+
76
103
  function ColorTools( {
77
104
  textColor,
78
105
  setTextColor,
@@ -284,8 +311,10 @@ function Navigation( {
284
311
  __unstableMarkNextChangeAsNotPersistent,
285
312
  } = useDispatch( blockEditorStore );
286
313
 
314
+ const navRef = useRef();
315
+
287
316
  const [ isResponsiveMenuOpen, setResponsiveMenuVisibility ] =
288
- useState( false );
317
+ useResponsiveMenu( navRef );
289
318
 
290
319
  const [ overlayMenuPreview, setOverlayMenuPreview ] = useState( false );
291
320
 
@@ -367,8 +396,6 @@ function Navigation( {
367
396
  __unstableMarkNextChangeAsNotPersistent,
368
397
  ] );
369
398
 
370
- const navRef = useRef();
371
-
372
399
  // The standard HTML5 tag for the block wrapper.
373
400
  const TagName = 'nav';
374
401
 
@@ -26,8 +26,8 @@ import LeafMoreMenu from './leaf-more-menu';
26
26
  import { updateAttributes } from '../../navigation-link/update-attributes';
27
27
  import { LinkUI } from '../../navigation-link/link-ui';
28
28
 
29
- /* translators: %s: The name of a menu. */
30
- const actionLabel = __( "Switch to '%s'" );
29
+ const actionLabel =
30
+ /* translators: %s: The name of a menu. */ __( "Switch to '%s'" );
31
31
  const BLOCKS_WITH_LINK_UI_SUPPORT = [
32
32
  'core/navigation-link',
33
33
  'core/navigation-submenu',
@@ -21,7 +21,7 @@ import useNavigationEntities from '../use-navigation-entities';
21
21
 
22
22
  function buildMenuLabel( title, id, status ) {
23
23
  if ( ! title ) {
24
- /* translators: %s is the index of the menu in the list of menus. */
24
+ /* translators: %s: the index of the menu in the list of menus. */
25
25
  return sprintf( __( '(no title %s)' ), id );
26
26
  }
27
27
 
@@ -30,7 +30,7 @@ function buildMenuLabel( title, id, status ) {
30
30
  }
31
31
 
32
32
  return sprintf(
33
- // translators: %1s: title of the menu; %2s: status of the menu (draft, pending, etc.).
33
+ // translators: 1: title of the menu. 2: status of the menu (draft, pending, etc.).
34
34
  __( '%1$s (%2$s)' ),
35
35
  decodeEntities( title ),
36
36
  status
@@ -203,6 +203,7 @@ $color-control-label-height: 20px;
203
203
  .wp-block-navigation .wp-block + .block-list-appender .block-editor-button-block-appender {
204
204
  background-color: $gray-900;
205
205
  color: $white;
206
+ height: $button-size-small;
206
207
 
207
208
  // This needs specificity to override an inherited padding.
208
209
  // That source padding in turn has high specificity to protect
@@ -66,7 +66,7 @@ function DropCapControl( { clientId, attributes, setAttributes } ) {
66
66
  } else if ( dropCap ) {
67
67
  helpText = __( 'Showing large initial letter.' );
68
68
  } else {
69
- helpText = __( 'Toggle to show a large initial letter.' );
69
+ helpText = __( 'Show a large initial letter.' );
70
70
  }
71
71
 
72
72
  return (
@@ -207,7 +207,7 @@ export default function PostFeaturedImageEdit( {
207
207
  label={
208
208
  postType?.labels.singular_name
209
209
  ? sprintf(
210
- // translators: %s: Name of the post type e.g: "Page".
210
+ // translators: %s: Name of the post type e.g: "post".
211
211
  __( 'Link to %s' ),
212
212
  postType.labels.singular_name
213
213
  )
@@ -71,8 +71,8 @@ function PostTimeToReadEdit( { attributes, setAttributes, context } ) {
71
71
  );
72
72
 
73
73
  return sprintf(
74
- /* translators: %d is the number of minutes the post will take to read. */
75
- _n( '%d minute', '%d minutes', minutesToRead ),
74
+ /* translators: %s: the number of minutes to read the post. */
75
+ _n( '%s minute', '%s minutes', minutesToRead ),
76
76
  minutesToRead
77
77
  );
78
78
  }, [ contentStructure, blocks ] );
@@ -32,7 +32,7 @@ function render_block_core_post_time_to_read( $attributes, $content, $block ) {
32
32
  $minutes_to_read = max( 1, (int) round( wp_word_count( $content, $word_count_type ) / $average_reading_rate ) );
33
33
 
34
34
  $minutes_to_read_string = sprintf(
35
- /* translators: %s is the number of minutes the post will take to read. */
35
+ /* translators: %s: the number of minutes to read the post. */
36
36
  _n( '%s minute', '%s minutes', $minutes_to_read ),
37
37
  $minutes_to_read
38
38
  );
@@ -14,12 +14,12 @@ const orderOptions = [
14
14
  value: 'date/asc',
15
15
  },
16
16
  {
17
- /* translators: label for ordering posts by title in ascending order */
17
+ /* translators: Label for ordering posts by title in ascending order. */
18
18
  label: __( 'A → Z' ),
19
19
  value: 'title/asc',
20
20
  },
21
21
  {
22
- /* translators: label for ordering posts by title in descending order */
22
+ /* translators: Label for ordering posts by title in descending order. */
23
23
  label: __( 'Z → A' ),
24
24
  value: 'title/desc',
25
25
  },
@@ -15,7 +15,7 @@ import {
15
15
  HeadingLevelDropdown,
16
16
  } from '@wordpress/block-editor';
17
17
  import { ToggleControl, PanelBody } from '@wordpress/components';
18
- import { __, sprintf } from '@wordpress/i18n';
18
+ import { __, _x, sprintf } from '@wordpress/i18n';
19
19
 
20
20
  /**
21
21
  * Internal dependencies
@@ -60,7 +60,7 @@ export default function QueryTitleEdit( {
60
60
  if ( archiveNameLabel ) {
61
61
  title = sprintf(
62
62
  /* translators: 1: Archive type title e.g: "Category", 2: Label of the archive e.g: "Shoes" */
63
- __( '%1$s: %2$s' ),
63
+ _x( '%1$s: %2$s', 'archive label' ),
64
64
  archiveTypeLabel,
65
65
  archiveNameLabel
66
66
  );
package/src/rss/index.php CHANGED
@@ -62,7 +62,7 @@ function render_block_core_rss( $attributes ) {
62
62
  if ( is_object( $author ) ) {
63
63
  $author = $author->get_name();
64
64
  $author = '<span class="wp-block-rss__item-author">' . sprintf(
65
- /* translators: %s: the author. */
65
+ /* translators: byline. %s: author. */
66
66
  __( 'by %s' ),
67
67
  esc_html( strip_tags( $author ) )
68
68
  ) . '</span>';
@@ -23,14 +23,14 @@ import { useEffect, useRef } from '@wordpress/element';
23
23
  import {
24
24
  ToolbarDropdownMenu,
25
25
  ToolbarGroup,
26
- Button,
27
- ButtonGroup,
28
26
  ToolbarButton,
29
27
  ResizableBox,
30
28
  PanelBody,
31
29
  __experimentalVStack as VStack,
32
30
  __experimentalUseCustomUnits as useCustomUnits,
33
31
  __experimentalUnitControl as UnitControl,
32
+ __experimentalToggleGroupControl as ToggleGroupControl,
33
+ __experimentalToggleGroupControlOption as ToggleGroupControlOption,
34
34
  } from '@wordpress/components';
35
35
  import { useInstanceId } from '@wordpress/compose';
36
36
  import { Icon, search } from '@wordpress/icons';
@@ -58,6 +58,7 @@ import {
58
58
  // Used to calculate border radius adjustment to avoid "fat" corners when
59
59
  // button is placed inside wrapper.
60
60
  const DEFAULT_INNER_PADDING = '4px';
61
+ const PERCENTAGE_WIDTHS = [ 25, 50, 75, 100 ];
61
62
 
62
63
  export default function SearchEdit( {
63
64
  className,
@@ -375,7 +376,7 @@ export default function SearchEdit( {
375
376
  <BlockControls>
376
377
  <ToolbarGroup>
377
378
  <ToolbarButton
378
- title={ __( 'Toggle search label' ) }
379
+ title={ __( 'Show search label' ) }
379
380
  icon={ toggleLabel }
380
381
  onClick={ () => {
381
382
  setAttributes( {
@@ -445,33 +446,35 @@ export default function SearchEdit( {
445
446
  value={ `${ width }${ widthUnit }` }
446
447
  units={ units }
447
448
  />
448
- <ButtonGroup
449
- className="wp-block-search__components-button-group" // unused, kept for backwards compatibility
450
- aria-label={ __( 'Percentage Width' ) }
449
+ <ToggleGroupControl
450
+ label={ __( 'Percentage Width' ) }
451
+ value={
452
+ PERCENTAGE_WIDTHS.includes( width ) &&
453
+ widthUnit === '%'
454
+ ? width
455
+ : undefined
456
+ }
457
+ hideLabelFromVision
458
+ onChange={ ( newWidth ) => {
459
+ setAttributes( {
460
+ width: newWidth,
461
+ widthUnit: '%',
462
+ } );
463
+ } }
464
+ isBlock
465
+ __next40pxDefaultSize
466
+ __nextHasNoMarginBottom
451
467
  >
452
- { [ 25, 50, 75, 100 ].map( ( widthValue ) => {
468
+ { PERCENTAGE_WIDTHS.map( ( widthValue ) => {
453
469
  return (
454
- <Button
470
+ <ToggleGroupControlOption
455
471
  key={ widthValue }
456
- size="small"
457
- variant={
458
- widthValue === width &&
459
- widthUnit === '%'
460
- ? 'primary'
461
- : undefined
462
- }
463
- onClick={ () =>
464
- setAttributes( {
465
- width: widthValue,
466
- widthUnit: '%',
467
- } )
468
- }
469
- >
470
- { widthValue }%
471
- </Button>
472
+ value={ widthValue }
473
+ label={ `${ widthValue }%` }
474
+ />
472
475
  );
473
476
  } ) }
474
- </ButtonGroup>
477
+ </ToggleGroupControl>
475
478
  </VStack>
476
479
  </PanelBody>
477
480
  </InspectorControls>
@@ -17,3 +17,9 @@ exports[`Separator block transforms to Group block 1`] = `
17
17
  <!-- /wp:separator --></div>
18
18
  <!-- /wp:group -->"
19
19
  `;
20
+
21
+ exports[`Separator block transforms to Spacer block 1`] = `
22
+ "<!-- wp:spacer -->
23
+ <div style="height:100px" aria-hidden="true" class="wp-block-spacer"></div>
24
+ <!-- /wp:spacer -->"
25
+ `;
@@ -16,7 +16,7 @@ const initialHtml = `
16
16
  <!-- /wp:separator -->`;
17
17
 
18
18
  const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
19
- const blockTransforms = [ ...transformsWithInnerBlocks ];
19
+ const blockTransforms = [ 'Spacer', ...transformsWithInnerBlocks ];
20
20
 
21
21
  setupCoreBlocks();
22
22
 
@@ -18,6 +18,17 @@ const transforms = {
18
18
  },
19
19
  },
20
20
  ],
21
+ to: [
22
+ {
23
+ type: 'block',
24
+ blocks: [ 'core/spacer' ], // Transform to Spacer.
25
+ transform: ( { anchor } ) => {
26
+ return createBlock( 'core/spacer', {
27
+ anchor: anchor || '',
28
+ } );
29
+ },
30
+ },
31
+ ],
21
32
  };
22
33
 
23
34
  export default transforms;
@@ -86,7 +86,6 @@ export function SocialLinksEdit( props ) {
86
86
  } else {
87
87
  setAttributes( { ...backgroundBackupRef.current } );
88
88
  }
89
- // eslint-disable-next-line react-hooks/exhaustive-deps
90
89
  }, [ logosOnly ] );
91
90
 
92
91
  const SocialPlaceholder = (
@@ -10,6 +10,7 @@ import initBlock from '../utils/init-block';
10
10
  import deprecated from './deprecated';
11
11
  import edit from './edit';
12
12
  import metadata from './block.json';
13
+ import transforms from './transforms';
13
14
  import save from './save';
14
15
 
15
16
  const { name } = metadata;
@@ -18,6 +19,7 @@ export { metadata, name };
18
19
 
19
20
  export const settings = {
20
21
  icon,
22
+ transforms,
21
23
  edit,
22
24
  save,
23
25
  deprecated,
@@ -17,3 +17,9 @@ exports[`Spacer block transforms to Group block 1`] = `
17
17
  <!-- /wp:spacer --></div>
18
18
  <!-- /wp:group -->"
19
19
  `;
20
+
21
+ exports[`Spacer block transforms to Separator block 1`] = `
22
+ "<!-- wp:separator -->
23
+ <hr class="wp-block-separator has-alpha-channel-opacity"/>
24
+ <!-- /wp:separator -->"
25
+ `;
@@ -16,7 +16,7 @@ const initialHtml = `
16
16
  <!-- /wp:spacer -->`;
17
17
 
18
18
  const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
19
- const blockTransforms = [ ...transformsWithInnerBlocks ];
19
+ const blockTransforms = [ 'Separator', ...transformsWithInnerBlocks ];
20
20
 
21
21
  setupCoreBlocks();
22
22
 
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { createBlock } from '@wordpress/blocks';
5
+
6
+ const transforms = {
7
+ to: [
8
+ {
9
+ type: 'block',
10
+ blocks: [ 'core/separator' ], // Transform to Separator.
11
+ transform: ( { anchor } ) => {
12
+ return createBlock( 'core/separator', {
13
+ anchor: anchor || '',
14
+ } );
15
+ },
16
+ },
17
+ ],
18
+ };
19
+
20
+ export default transforms;
package/src/table/edit.js CHANGED
@@ -465,7 +465,6 @@ function TableEdit( {
465
465
  </BlockControls>
466
466
  <BlockControls group="other">
467
467
  <ToolbarDropdownMenu
468
- hasArrowIndicator
469
468
  icon={ table }
470
469
  label={ __( 'Edit table' ) }
471
470
  controls={ tableControls }
@@ -58,15 +58,11 @@ export default function TableOfContentsEdit( {
58
58
  );
59
59
 
60
60
  // If a user clicks to a link prevent redirection and show a warning.
61
- const { createWarningNotice, removeNotice } = useDispatch( noticeStore );
62
- let noticeId;
61
+ const { createWarningNotice } = useDispatch( noticeStore );
63
62
  const showRedirectionPreventedNotice = ( event ) => {
64
63
  event.preventDefault();
65
- // Remove previous warning if any, to show one at a time per block.
66
- removeNotice( noticeId );
67
- noticeId = `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`;
68
64
  createWarningNotice( __( 'Links are disabled in the editor.' ), {
69
- id: noticeId,
65
+ id: `block-library/core/table-of-contents/redirection-prevented/${ instanceId }`,
70
66
  type: 'snackbar',
71
67
  } );
72
68
  };
@@ -214,7 +214,7 @@ export default function TemplatePartEdit( {
214
214
  <TagName { ...blockProps }>
215
215
  <Warning>
216
216
  { sprintf(
217
- /* translators: %s: Template part slug */
217
+ /* translators: %s: Template part slug. */
218
218
  __(
219
219
  'Template part has been deleted or is unavailable: %s'
220
220
  ),
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __, sprintf } from '@wordpress/i18n';
4
+ import { __, _x, sprintf } from '@wordpress/i18n';
5
5
  import {
6
6
  NavigableMenu,
7
7
  MenuItem,
@@ -63,7 +63,7 @@ function TrackList( { tracks, onEditPress } ) {
63
63
  onClick={ () => onEditPress( index ) }
64
64
  aria-label={ sprintf(
65
65
  /* translators: %s: Label of the video text track e.g: "French subtitles" */
66
- __( 'Edit %s' ),
66
+ _x( 'Edit %s', 'text tracks' ),
67
67
  track.label
68
68
  ) }
69
69
  >