@wordpress/block-library 8.28.5 → 8.30.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 (289) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/audio/edit.js +7 -17
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/audio/edit.native.js.map +1 -1
  5. package/build/avatar/edit.js.map +1 -1
  6. package/build/button/edit.js +1 -1
  7. package/build/button/edit.js.map +1 -1
  8. package/build/buttons/edit.js +1 -6
  9. package/build/buttons/edit.js.map +1 -1
  10. package/build/buttons/edit.native.js +1 -7
  11. package/build/buttons/edit.native.js.map +1 -1
  12. package/build/columns/edit.js +8 -2
  13. package/build/columns/edit.js.map +1 -1
  14. package/build/comment-author-avatar/edit.js +1 -1
  15. package/build/comment-author-avatar/edit.js.map +1 -1
  16. package/build/cover/edit/index.js.map +1 -1
  17. package/build/cover/edit/inspector-controls.js.map +1 -1
  18. package/build/cover/edit/resizable-cover-popover.js +0 -6
  19. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  20. package/build/cover/edit.native.js.map +1 -1
  21. package/build/details/index.js +1 -0
  22. package/build/details/index.js.map +1 -1
  23. package/build/file/deprecated.js.map +1 -1
  24. package/build/file/edit.js +6 -13
  25. package/build/file/edit.js.map +1 -1
  26. package/build/file/edit.native.js.map +1 -1
  27. package/build/file/save.js.map +1 -1
  28. package/build/form-input/edit.js +1 -1
  29. package/build/form-input/edit.js.map +1 -1
  30. package/build/gallery/edit.js +5 -5
  31. package/build/gallery/edit.js.map +1 -1
  32. package/build/gallery/gallery.native.js.map +1 -1
  33. package/build/gallery/v1/edit.js.map +1 -1
  34. package/build/gallery/v1/gallery.native.js.map +1 -1
  35. package/build/group/variations.js +12 -15
  36. package/build/group/variations.js.map +1 -1
  37. package/build/image/edit.js.map +1 -1
  38. package/build/image/edit.native.js.map +1 -1
  39. package/build/image/image.js.map +1 -1
  40. package/build/latest-posts/edit.native.js.map +1 -1
  41. package/build/list/edit.js +5 -0
  42. package/build/list/edit.js.map +1 -1
  43. package/build/list/ordered-list-settings.js +1 -1
  44. package/build/list/ordered-list-settings.js.map +1 -1
  45. package/build/list-item/edit.native.js.map +1 -1
  46. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  47. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  48. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  49. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  50. package/build/list-item/hooks/use-space.js +16 -7
  51. package/build/list-item/hooks/use-space.js.map +1 -1
  52. package/build/media-text/media-container.native.js +1 -1
  53. package/build/media-text/media-container.native.js.map +1 -1
  54. package/build/navigation/edit/index.js.map +1 -1
  55. package/build/navigation-link/link-ui.js.map +1 -1
  56. package/build/paragraph/edit.native.js.map +1 -1
  57. package/build/pattern/edit.js +23 -9
  58. package/build/pattern/edit.js.map +1 -1
  59. package/build/post-excerpt/edit.js.map +1 -1
  60. package/build/post-featured-image/dimension-controls.js.map +1 -1
  61. package/build/post-featured-image/edit.js.map +1 -1
  62. package/build/post-navigation-link/edit.js.map +1 -1
  63. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  64. package/build/query/utils.js +7 -5
  65. package/build/query/utils.js.map +1 -1
  66. package/build/query-pagination-next/edit.js.map +1 -1
  67. package/build/query-pagination-previous/edit.js.map +1 -1
  68. package/build/quote/deprecated.js +111 -12
  69. package/build/quote/deprecated.js.map +1 -1
  70. package/build/quote/edit.js +5 -5
  71. package/build/quote/edit.js.map +1 -1
  72. package/build/quote/index.js +1 -1
  73. package/build/quote/index.js.map +1 -1
  74. package/build/quote/save.js +2 -2
  75. package/build/quote/save.js.map +1 -1
  76. package/build/read-more/edit.js.map +1 -1
  77. package/build/search/edit.js +1 -1
  78. package/build/search/edit.js.map +1 -1
  79. package/build/search/edit.native.js.map +1 -1
  80. package/build/site-logo/edit.js.map +1 -1
  81. package/build/site-title/{edit/index.js → edit.js} +1 -1
  82. package/build/site-title/edit.js.map +1 -0
  83. package/build/social-link/edit.js.map +1 -1
  84. package/build/social-links/edit.native.js.map +1 -1
  85. package/build/spacer/edit.js.map +1 -1
  86. package/build/table-of-contents/edit.js.map +1 -1
  87. package/build/template-part/edit/index.js +53 -1
  88. package/build/template-part/edit/index.js.map +1 -1
  89. package/build/template-part/edit/selection-modal.js +2 -8
  90. package/build/template-part/edit/selection-modal.js.map +1 -1
  91. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  92. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  93. package/build/utils/hooks.js +55 -4
  94. package/build/utils/hooks.js.map +1 -1
  95. package/build/video/edit-common-settings.js.map +1 -1
  96. package/build/video/edit.js +7 -16
  97. package/build/video/edit.js.map +1 -1
  98. package/build/video/edit.native.js +2 -7
  99. package/build/video/edit.native.js.map +1 -1
  100. package/build-module/audio/edit.js +10 -20
  101. package/build-module/audio/edit.js.map +1 -1
  102. package/build-module/audio/edit.native.js.map +1 -1
  103. package/build-module/avatar/edit.js.map +1 -1
  104. package/build-module/button/edit.js +1 -1
  105. package/build-module/button/edit.js.map +1 -1
  106. package/build-module/buttons/edit.js +2 -7
  107. package/build-module/buttons/edit.js.map +1 -1
  108. package/build-module/buttons/edit.native.js +1 -7
  109. package/build-module/buttons/edit.native.js.map +1 -1
  110. package/build-module/columns/edit.js +8 -2
  111. package/build-module/columns/edit.js.map +1 -1
  112. package/build-module/comment-author-avatar/edit.js +1 -1
  113. package/build-module/comment-author-avatar/edit.js.map +1 -1
  114. package/build-module/cover/edit/index.js.map +1 -1
  115. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  116. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  117. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  118. package/build-module/cover/edit.native.js.map +1 -1
  119. package/build-module/details/index.js +1 -0
  120. package/build-module/details/index.js.map +1 -1
  121. package/build-module/file/deprecated.js.map +1 -1
  122. package/build-module/file/edit.js +7 -14
  123. package/build-module/file/edit.js.map +1 -1
  124. package/build-module/file/edit.native.js.map +1 -1
  125. package/build-module/file/save.js.map +1 -1
  126. package/build-module/form-input/edit.js +1 -1
  127. package/build-module/form-input/edit.js.map +1 -1
  128. package/build-module/gallery/edit.js +5 -5
  129. package/build-module/gallery/edit.js.map +1 -1
  130. package/build-module/gallery/gallery.native.js.map +1 -1
  131. package/build-module/gallery/v1/edit.js.map +1 -1
  132. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  133. package/build-module/group/variations.js +12 -15
  134. package/build-module/group/variations.js.map +1 -1
  135. package/build-module/image/edit.js.map +1 -1
  136. package/build-module/image/edit.native.js.map +1 -1
  137. package/build-module/image/image.js.map +1 -1
  138. package/build-module/latest-posts/edit.native.js.map +1 -1
  139. package/build-module/list/edit.js +5 -0
  140. package/build-module/list/edit.js.map +1 -1
  141. package/build-module/list/ordered-list-settings.js +1 -1
  142. package/build-module/list/ordered-list-settings.js.map +1 -1
  143. package/build-module/list-item/edit.native.js.map +1 -1
  144. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  145. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  146. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  147. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  148. package/build-module/list-item/hooks/use-space.js +17 -8
  149. package/build-module/list-item/hooks/use-space.js.map +1 -1
  150. package/build-module/media-text/media-container.native.js +1 -1
  151. package/build-module/media-text/media-container.native.js.map +1 -1
  152. package/build-module/navigation/edit/index.js.map +1 -1
  153. package/build-module/navigation-link/link-ui.js.map +1 -1
  154. package/build-module/paragraph/edit.native.js.map +1 -1
  155. package/build-module/pattern/edit.js +24 -10
  156. package/build-module/pattern/edit.js.map +1 -1
  157. package/build-module/post-excerpt/edit.js.map +1 -1
  158. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  159. package/build-module/post-featured-image/edit.js.map +1 -1
  160. package/build-module/post-navigation-link/edit.js.map +1 -1
  161. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  162. package/build-module/query/utils.js +7 -5
  163. package/build-module/query/utils.js.map +1 -1
  164. package/build-module/query-pagination-next/edit.js.map +1 -1
  165. package/build-module/query-pagination-previous/edit.js.map +1 -1
  166. package/build-module/quote/deprecated.js +112 -13
  167. package/build-module/quote/deprecated.js.map +1 -1
  168. package/build-module/quote/edit.js +5 -5
  169. package/build-module/quote/edit.js.map +1 -1
  170. package/build-module/quote/index.js +1 -1
  171. package/build-module/quote/index.js.map +1 -1
  172. package/build-module/quote/save.js +2 -2
  173. package/build-module/quote/save.js.map +1 -1
  174. package/build-module/read-more/edit.js.map +1 -1
  175. package/build-module/search/edit.js +1 -1
  176. package/build-module/search/edit.js.map +1 -1
  177. package/build-module/search/edit.native.js.map +1 -1
  178. package/build-module/site-logo/edit.js.map +1 -1
  179. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  180. package/build-module/site-title/edit.js.map +1 -0
  181. package/build-module/social-link/edit.js.map +1 -1
  182. package/build-module/social-links/edit.native.js.map +1 -1
  183. package/build-module/spacer/edit.js.map +1 -1
  184. package/build-module/table-of-contents/edit.js.map +1 -1
  185. package/build-module/template-part/edit/index.js +57 -5
  186. package/build-module/template-part/edit/index.js.map +1 -1
  187. package/build-module/template-part/edit/selection-modal.js +2 -8
  188. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  189. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  190. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  191. package/build-module/utils/hooks.js +54 -3
  192. package/build-module/utils/hooks.js.map +1 -1
  193. package/build-module/video/edit-common-settings.js.map +1 -1
  194. package/build-module/video/edit.js +10 -19
  195. package/build-module/video/edit.js.map +1 -1
  196. package/build-module/video/edit.native.js +2 -7
  197. package/build-module/video/edit.native.js.map +1 -1
  198. package/build-style/editor-rtl.css +4 -1
  199. package/build-style/editor.css +4 -1
  200. package/build-style/group/editor-rtl.css +1 -1
  201. package/build-style/group/editor.css +1 -1
  202. package/build-style/image/editor-rtl.css +3 -0
  203. package/build-style/image/editor.css +3 -0
  204. package/package.json +34 -34
  205. package/src/audio/edit.js +9 -19
  206. package/src/audio/edit.native.js +3 -3
  207. package/src/avatar/edit.js +1 -1
  208. package/src/avatar/index.php +12 -1
  209. package/src/block/index.php +2 -0
  210. package/src/button/edit.js +2 -2
  211. package/src/buttons/edit.js +3 -16
  212. package/src/buttons/edit.native.js +2 -18
  213. package/src/calendar/index.php +5 -0
  214. package/src/columns/edit.js +9 -2
  215. package/src/comment-author-avatar/edit.js +1 -1
  216. package/src/comments/index.php +2 -0
  217. package/src/cover/edit/index.js +2 -2
  218. package/src/cover/edit/inspector-controls.js +1 -1
  219. package/src/cover/edit/resizable-cover-popover.js +1 -6
  220. package/src/cover/edit.native.js +1 -1
  221. package/src/details/block.json +1 -0
  222. package/src/file/deprecated.js +3 -3
  223. package/src/file/edit.js +8 -15
  224. package/src/file/edit.native.js +4 -4
  225. package/src/file/save.js +1 -1
  226. package/src/form-input/edit.js +1 -1
  227. package/src/gallery/edit.js +6 -12
  228. package/src/gallery/gallery.native.js +1 -1
  229. package/src/gallery/test/index.native.js +1 -1
  230. package/src/gallery/v1/edit.js +2 -2
  231. package/src/gallery/v1/gallery.native.js +1 -1
  232. package/src/group/editor.scss +1 -1
  233. package/src/group/variations.js +3 -6
  234. package/src/image/edit.js +1 -1
  235. package/src/image/edit.native.js +1 -1
  236. package/src/image/editor.scss +6 -0
  237. package/src/image/image.js +2 -2
  238. package/src/latest-posts/edit.native.js +1 -1
  239. package/src/list/edit.js +5 -0
  240. package/src/list/ordered-list-settings.js +1 -1
  241. package/src/list-item/edit.native.js +1 -1
  242. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  243. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  244. package/src/list-item/hooks/use-space.js +16 -9
  245. package/src/media-text/media-container.native.js +5 -3
  246. package/src/media-text/test/edit.native.js +58 -0
  247. package/src/missing/test/edit-integration.native.js +2 -1
  248. package/src/navigation/edit/index.js +1 -1
  249. package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
  250. package/src/navigation/index.php +18 -13
  251. package/src/navigation-link/link-ui.js +2 -2
  252. package/src/paragraph/edit.native.js +1 -1
  253. package/src/paragraph/test/edit.native.js +36 -0
  254. package/src/pattern/edit.js +27 -10
  255. package/src/post-author-biography/index.php +4 -3
  256. package/src/post-author-name/index.php +4 -3
  257. package/src/post-excerpt/edit.js +1 -1
  258. package/src/post-featured-image/dimension-controls.js +4 -4
  259. package/src/post-featured-image/edit.js +1 -1
  260. package/src/post-navigation-link/edit.js +1 -1
  261. package/src/post-template/index.php +2 -0
  262. package/src/query/edit/pattern-selection-modal.js +1 -1
  263. package/src/query/utils.js +6 -4
  264. package/src/query-pagination-next/edit.js +1 -1
  265. package/src/query-pagination-previous/edit.js +1 -1
  266. package/src/quote/block.json +1 -1
  267. package/src/quote/deprecated.js +110 -15
  268. package/src/quote/edit.js +5 -5
  269. package/src/quote/save.js +2 -2
  270. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  271. package/src/read-more/edit.js +1 -1
  272. package/src/search/edit.js +1 -1
  273. package/src/search/edit.native.js +4 -4
  274. package/src/site-logo/edit.js +1 -1
  275. package/src/social-link/edit.js +1 -1
  276. package/src/social-links/edit.native.js +1 -1
  277. package/src/spacer/edit.js +1 -1
  278. package/src/table-of-contents/edit.js +1 -1
  279. package/src/template-part/edit/index.js +91 -4
  280. package/src/template-part/edit/selection-modal.js +4 -8
  281. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  282. package/src/utils/hooks.js +53 -3
  283. package/src/video/edit-common-settings.js +1 -1
  284. package/src/video/edit.js +10 -18
  285. package/src/video/edit.native.js +5 -8
  286. package/src/video/test/edit.native.js +0 -14
  287. package/build/site-title/edit/index.js.map +0 -1
  288. package/build-module/site-title/edit/index.js.map +0 -1
  289. /package/src/site-title/{edit/index.js → edit.js} +0 -0
@@ -282,7 +282,7 @@ export class FileEdit extends Component {
282
282
  value={ textLinkHref }
283
283
  onChange={ this.onChangeLinkDestinationOption }
284
284
  options={ linkDestinationOptions }
285
- hideCancelButton={ true }
285
+ hideCancelButton
286
286
  />
287
287
  <ToggleControl
288
288
  icon={ external }
@@ -469,7 +469,7 @@ export class FileEdit extends Component {
469
469
  tagName="p"
470
470
  underlineColorAndroid="transparent"
471
471
  value={ fileName }
472
- deleteEnter={ true }
472
+ deleteEnter
473
473
  textAlign={ this.getTextAlignmentForAlignment(
474
474
  align
475
475
  ) }
@@ -505,7 +505,7 @@ export class FileEdit extends Component {
505
505
  textAlign="center"
506
506
  minWidth={ minWidth }
507
507
  maxWidth={ this.state.maxWidth }
508
- deleteEnter={ true }
508
+ deleteEnter
509
509
  style={ styles.buttonText }
510
510
  value={ downloadButtonText }
511
511
  placeholder={ placeholderText }
@@ -565,7 +565,7 @@ export class FileEdit extends Component {
565
565
  return (
566
566
  <MediaUpload
567
567
  allowedTypes={ [ MEDIA_TYPE_ANY ] }
568
- isReplacingMedia={ true }
568
+ isReplacingMedia
569
569
  onSelect={ this.onSelectFile }
570
570
  render={ ( { open, getMediaOptions } ) => {
571
571
  return this.getFileComponent( open, getMediaOptions );
package/src/file/save.js CHANGED
@@ -73,7 +73,7 @@ export default function save( { attributes } ) {
73
73
  'wp-block-file__button',
74
74
  __experimentalGetElementClassName( 'button' )
75
75
  ) }
76
- download={ true }
76
+ download
77
77
  aria-describedby={ describedById }
78
78
  >
79
79
  <RichText.Content value={ downloadButtonText } />
@@ -35,7 +35,7 @@ function InputFieldBlock( { attributes, setAttributes, className } ) {
35
35
  <>
36
36
  { 'hidden' !== type && (
37
37
  <InspectorControls>
38
- <PanelBody title={ __( 'Input settings' ) }>
38
+ <PanelBody title={ __( 'Settings' ) }>
39
39
  { 'checkbox' !== type && (
40
40
  <CheckboxControl
41
41
  label={ __( 'Inline label' ) }
@@ -73,6 +73,7 @@ const MOBILE_CONTROL_PROPS_RANGE_CONTROL = Platform.isNative
73
73
  ? { type: 'stepper' }
74
74
  : {};
75
75
 
76
+ const DEFAULT_BLOCK = { name: 'core/image' };
76
77
  const EMPTY_ARRAY = [];
77
78
 
78
79
  function GalleryEdit( props ) {
@@ -102,7 +103,6 @@ function GalleryEdit( props ) {
102
103
  const {
103
104
  getBlock,
104
105
  getSettings,
105
- preferredStyle,
106
106
  innerBlockImages,
107
107
  blockWasJustInserted,
108
108
  multiGallerySelection,
@@ -115,15 +115,11 @@ function GalleryEdit( props ) {
115
115
  getBlock: _getBlock,
116
116
  wasBlockJustInserted,
117
117
  } = select( blockEditorStore );
118
- const preferredStyleVariations =
119
- _getSettings().__experimentalPreferredStyleVariations;
120
118
  const multiSelectedClientIds = getMultiSelectedBlockClientIds();
121
119
 
122
120
  return {
123
121
  getBlock: _getBlock,
124
122
  getSettings: _getSettings,
125
- preferredStyle:
126
- preferredStyleVariations?.value?.[ 'core/image' ],
127
123
  innerBlockImages:
128
124
  _getBlock( clientId )?.innerBlocks ?? EMPTY_ARRAY,
129
125
  blockWasJustInserted: wasBlockJustInserted(
@@ -195,10 +191,6 @@ function GalleryEdit( props ) {
195
191
  let newClassName;
196
192
  if ( imageAttributes.className && imageAttributes.className !== '' ) {
197
193
  newClassName = imageAttributes.className;
198
- } else {
199
- newClassName = preferredStyle
200
- ? `is-style-${ preferredStyle }`
201
- : undefined;
202
194
  }
203
195
 
204
196
  let newLinkTarget;
@@ -505,6 +497,8 @@ function GalleryEdit( props ) {
505
497
  };
506
498
 
507
499
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
500
+ defaultBlock: DEFAULT_BLOCK,
501
+ directInsert: true,
508
502
  orientation: 'horizontal',
509
503
  renderAppender: false,
510
504
  ...nativeInnerBlockProps,
@@ -552,7 +546,7 @@ function GalleryEdit( props ) {
552
546
  value={ sizeSlug }
553
547
  options={ imageSizeOptions }
554
548
  onChange={ updateImagesSize }
555
- hideCancelButton={ true }
549
+ hideCancelButton
556
550
  size="__unstable-large"
557
551
  />
558
552
  ) }
@@ -562,7 +556,7 @@ function GalleryEdit( props ) {
562
556
  value={ linkTo }
563
557
  onChange={ setLinkTo }
564
558
  options={ linkOptions }
565
- hideCancelButton={ true }
559
+ hideCancelButton
566
560
  size="__unstable-large"
567
561
  />
568
562
  <ToggleControl
@@ -608,7 +602,7 @@ function GalleryEdit( props ) {
608
602
  handleUpload={ false }
609
603
  onSelect={ updateImages }
610
604
  name={ __( 'Add' ) }
611
- multiple={ true }
605
+ multiple
612
606
  mediaIds={ images
613
607
  .filter( ( image ) => image.id )
614
608
  .map( ( image ) => image.id ) }
@@ -100,7 +100,7 @@ export const Gallery = ( props ) => {
100
100
  <BlockCaption
101
101
  clientId={ clientId }
102
102
  isSelected={ isCaptionSelected }
103
- accessible={ true }
103
+ accessible
104
104
  accessibilityLabelCreator={ ( caption ) =>
105
105
  RichText.isEmpty( caption )
106
106
  ? /* translators: accessibility text. Empty gallery caption. */
@@ -92,7 +92,7 @@ describe( 'Gallery block', () => {
92
92
  expect( getBlock( screen, 'Gallery' ) ).toBeVisible();
93
93
  expect( getEditorHtml() ).toMatchSnapshot();
94
94
 
95
- getBlockSpy.mockReset();
95
+ getBlockSpy.mockRestore();
96
96
  } );
97
97
 
98
98
  it( 'selects a gallery item', async () => {
@@ -411,7 +411,7 @@ function GalleryEdit( props ) {
411
411
  value={ linkTo }
412
412
  onChange={ setLinkTo }
413
413
  options={ linkOptions }
414
- hideCancelButton={ true }
414
+ hideCancelButton
415
415
  />
416
416
  { shouldShowSizeOptions && (
417
417
  <SelectControl
@@ -420,7 +420,7 @@ function GalleryEdit( props ) {
420
420
  value={ sizeSlug }
421
421
  options={ imageSizeOptions }
422
422
  onChange={ updateImagesSize }
423
- hideCancelButton={ true }
423
+ hideCancelButton
424
424
  />
425
425
  ) }
426
426
  </PanelBody>
@@ -140,7 +140,7 @@ export const Gallery = ( props ) => {
140
140
  <BlockCaption
141
141
  clientId={ clientId }
142
142
  isSelected={ isCaptionSelected }
143
- accessible={ true }
143
+ accessible
144
144
  accessibilityLabelCreator={ ( caption ) =>
145
145
  RichText.isEmpty( caption )
146
146
  ? /* translators: accessibility text. Empty gallery caption. */
@@ -65,7 +65,6 @@
65
65
  margin: 0;
66
66
  }
67
67
  .components-placeholder__instructions {
68
- text-align: center;
69
68
  margin-bottom: 18px;
70
69
  }
71
70
  .wp-block-group-placeholder__variations svg {
@@ -92,6 +91,7 @@
92
91
  .components-placeholder {
93
92
  min-height: auto;
94
93
  padding: $grid-unit-30;
94
+ align-items: center;
95
95
  }
96
96
  .is-small,
97
97
  .is-medium {
@@ -42,10 +42,7 @@ const variations = [
42
42
  blockAttributes.layout?.orientation === 'vertical',
43
43
  icon: stack,
44
44
  },
45
- ];
46
-
47
- if ( window?.__experimentalEnableGroupGridVariation ) {
48
- variations.push( {
45
+ {
49
46
  name: 'group-grid',
50
47
  title: __( 'Grid' ),
51
48
  description: __( 'Arrange blocks in a grid.' ),
@@ -54,7 +51,7 @@ if ( window?.__experimentalEnableGroupGridVariation ) {
54
51
  isActive: ( blockAttributes ) =>
55
52
  blockAttributes.layout?.type === 'grid',
56
53
  icon: grid,
57
- } );
58
- }
54
+ },
55
+ ];
59
56
 
60
57
  export default variations;
package/src/image/edit.js CHANGED
@@ -369,7 +369,7 @@ export function ImageEdit( {
369
369
  [ borderProps.className ]:
370
370
  !! borderProps.className && ! isSingleSelected,
371
371
  } ) }
372
- withIllustration={ true }
372
+ withIllustration
373
373
  icon={ lockUrlControls ? pluginsIcon : icon }
374
374
  label={ __( 'Image' ) }
375
375
  instructions={
@@ -889,7 +889,7 @@ export class ImageEdit extends Component {
889
889
  return (
890
890
  <MediaUpload
891
891
  allowedTypes={ [ MEDIA_TYPE_IMAGE ] }
892
- isReplacingMedia={ true }
892
+ isReplacingMedia
893
893
  onSelect={ this.onSelectMediaUploadOption }
894
894
  onSelectURL={ this.onSelectURL }
895
895
  render={ ( { open, getMediaOptions } ) => {
@@ -1,6 +1,12 @@
1
1
  // Provide special styling for the placeholder.
2
2
  // @todo: this particular minimal style of placeholder could be componentized further.
3
3
  .wp-block-image.wp-block-image {
4
+
5
+ &:not(.is-selected) .components-placeholder__fieldset {
6
+ // Show only is selected.
7
+ display: none;
8
+ }
9
+
4
10
  // Show Placeholder style on-select.
5
11
  &.is-selected .components-placeholder {
6
12
  // Block UI appearance.
@@ -78,7 +78,7 @@ const ImageWrapper = ( { href, children } ) => {
78
78
  <a
79
79
  href={ href }
80
80
  onClick={ ( event ) => event.preventDefault() }
81
- aria-disabled={ true }
81
+ aria-disabled
82
82
  style={ {
83
83
  // When the Image block is linked,
84
84
  // it's wrapped with a disabled <a /> tag.
@@ -647,7 +647,7 @@ export default function Image( {
647
647
  { isSingleSelected && (
648
648
  <ToolsPanelItem
649
649
  label={ __( 'Alternative text' ) }
650
- isShownByDefault={ true }
650
+ isShownByDefault
651
651
  hasValue={ () => !! alt }
652
652
  onDeselect={ () =>
653
653
  setAttributes( { alt: undefined } )
@@ -201,7 +201,7 @@ class LatestPostsEdit extends Component {
201
201
  value={ featuredImageAlign }
202
202
  onChange={ this.onSetFeaturedImageAlign }
203
203
  controls={ [ 'left', 'center', 'right' ] }
204
- isBottomSheetControl={ true }
204
+ isBottomSheetControl
205
205
  />
206
206
  <ToggleControl
207
207
  label={ __( 'Add link to featured image' ) }
package/src/list/edit.js CHANGED
@@ -29,6 +29,9 @@ import OrderedListSettings from './ordered-list-settings';
29
29
  import { migrateToListV2 } from './utils';
30
30
  import TagName from './tag-name';
31
31
 
32
+ const DEFAULT_BLOCK = {
33
+ name: 'core/list-item',
34
+ };
32
35
  const TEMPLATE = [ [ 'core/list-item' ] ];
33
36
  const NATIVE_MARGIN_SPACING = 8;
34
37
 
@@ -125,6 +128,8 @@ export default function Edit( { attributes, setAttributes, clientId, style } ) {
125
128
  } );
126
129
 
127
130
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
131
+ defaultBlock: DEFAULT_BLOCK,
132
+ directInsert: true,
128
133
  template: TEMPLATE,
129
134
  templateLock: false,
130
135
  templateInsertUpdatesSelection: true,
@@ -12,7 +12,7 @@ import {
12
12
 
13
13
  const OrderedListSettings = ( { setAttributes, reversed, start, type } ) => (
14
14
  <InspectorControls>
15
- <PanelBody title={ __( 'Ordered list settings' ) }>
15
+ <PanelBody title={ __( 'Settings' ) }>
16
16
  <TextControl
17
17
  __nextHasNoMarginBottom
18
18
  label={ __( 'Start value' ) }
@@ -181,7 +181,7 @@ export default function ListItemEdit( {
181
181
  onReplace={ onReplaceList }
182
182
  onEnter={ onEnter }
183
183
  style={ styleWithPlaceholderOpacity }
184
- deleteEnter={ true }
184
+ deleteEnter
185
185
  containerWidth={ contentWidth }
186
186
  />
187
187
  </View>
@@ -61,5 +61,7 @@ export default function useIndentListItem( clientId ) {
61
61
  clonedBlocks[ clonedBlocks.length - 1 ].clientId
62
62
  );
63
63
  }
64
+
65
+ return true;
64
66
  }, [ clientId ] );
65
67
  }
@@ -93,5 +93,7 @@ export default function useOutdentListItem() {
93
93
  removeBlock( parentListId, shouldSelectParent );
94
94
  }
95
95
  } );
96
+
97
+ return true;
96
98
  }, [] );
97
99
  }
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { useRefEffect } from '@wordpress/compose';
5
- import { SPACE } from '@wordpress/keycodes';
5
+ import { SPACE, TAB } from '@wordpress/keycodes';
6
6
  import { store as blockEditorStore } from '@wordpress/block-editor';
7
7
  import { useSelect } from '@wordpress/data';
8
8
 
@@ -10,11 +10,13 @@ import { useSelect } from '@wordpress/data';
10
10
  * Internal dependencies
11
11
  */
12
12
  import useIndentListItem from './use-indent-list-item';
13
+ import useOutdentListItem from './use-outdent-list-item';
13
14
 
14
15
  export default function useSpace( clientId ) {
15
16
  const { getSelectionStart, getSelectionEnd, getBlockIndex } =
16
17
  useSelect( blockEditorStore );
17
18
  const indentListItem = useIndentListItem( clientId );
19
+ const outdentListItem = useOutdentListItem();
18
20
 
19
21
  return useRefEffect(
20
22
  ( element ) => {
@@ -23,9 +25,8 @@ export default function useSpace( clientId ) {
23
25
 
24
26
  if (
25
27
  event.defaultPrevented ||
26
- keyCode !== SPACE ||
28
+ ( keyCode !== SPACE && keyCode !== TAB ) ||
27
29
  // Only override when no modifiers are pressed.
28
- shiftKey ||
29
30
  altKey ||
30
31
  metaKey ||
31
32
  ctrlKey
@@ -33,18 +34,24 @@ export default function useSpace( clientId ) {
33
34
  return;
34
35
  }
35
36
 
36
- if ( getBlockIndex( clientId ) === 0 ) {
37
- return;
38
- }
39
-
40
37
  const selectionStart = getSelectionStart();
41
38
  const selectionEnd = getSelectionEnd();
42
39
  if (
43
40
  selectionStart.offset === 0 &&
44
41
  selectionEnd.offset === 0
45
42
  ) {
46
- event.preventDefault();
47
- indentListItem();
43
+ if ( shiftKey ) {
44
+ // Note that backspace behaviour in defined in onMerge.
45
+ if ( keyCode === TAB ) {
46
+ if ( outdentListItem() ) {
47
+ event.preventDefault();
48
+ }
49
+ }
50
+ } else if ( getBlockIndex( clientId ) !== 0 ) {
51
+ if ( indentListItem() ) {
52
+ event.preventDefault();
53
+ }
54
+ }
48
55
  }
49
56
  }
50
57
 
@@ -265,7 +265,7 @@ class MediaContainer extends Component {
265
265
  isSelected={ isSelected }
266
266
  style={ styles.video }
267
267
  source={ { uri: mediaUrl } }
268
- paused={ true }
268
+ paused
269
269
  />
270
270
  </View>
271
271
  ) }
@@ -329,7 +329,7 @@ class MediaContainer extends Component {
329
329
  if ( mediaUrl ) {
330
330
  return (
331
331
  <MediaUpload
332
- isReplacingMedia={ true }
332
+ isReplacingMedia
333
333
  onSelect={ this.onSelectMediaUploadOption }
334
334
  allowedTypes={ ALLOWED_MEDIA_TYPES }
335
335
  value={ mediaId }
@@ -341,7 +341,9 @@ class MediaContainer extends Component {
341
341
  { getMediaOptions() }
342
342
 
343
343
  <MediaUploadProgress
344
- enablePausedUploads
344
+ enablePausedUploads={
345
+ mediaType === MEDIA_TYPE_IMAGE
346
+ }
345
347
  coverUrl={ coverUrl }
346
348
  mediaId={ mediaId }
347
349
  onUpdateMediaProgress={
@@ -0,0 +1,58 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import {
5
+ addBlock,
6
+ fireEvent,
7
+ initializeEditor,
8
+ screen,
9
+ setupCoreBlocks,
10
+ } from 'test/helpers';
11
+
12
+ /**
13
+ * WordPress dependencies
14
+ */
15
+ import {
16
+ requestMediaPicker,
17
+ sendMediaUpload,
18
+ subscribeMediaUpload,
19
+ } from '@wordpress/react-native-bridge';
20
+ import { MEDIA_UPLOAD_STATE_PAUSED } from '@wordpress/block-editor';
21
+
22
+ let uploadCallBack;
23
+ subscribeMediaUpload.mockImplementation( ( callback ) => {
24
+ uploadCallBack = callback;
25
+ } );
26
+ sendMediaUpload.mockImplementation( ( payload ) => {
27
+ uploadCallBack( payload );
28
+ } );
29
+
30
+ setupCoreBlocks( [ 'core/media-text' ] );
31
+
32
+ describe( 'Media & Text block edit', () => {
33
+ it( 'should display an error message for failed video uploads', async () => {
34
+ requestMediaPicker.mockImplementation(
35
+ ( source, filter, multiple, callback ) => {
36
+ callback( {
37
+ id: 1,
38
+ url: 'file://video.mp4',
39
+ type: 'video',
40
+ } );
41
+ }
42
+ );
43
+ await initializeEditor();
44
+ await addBlock( screen, 'Media & Text' );
45
+ fireEvent.press( screen.getByText( 'Add image or video' ) );
46
+ fireEvent.press( screen.getByText( 'Choose from device' ) );
47
+
48
+ sendMediaUpload( {
49
+ mediaId: 1,
50
+ state: MEDIA_UPLOAD_STATE_PAUSED,
51
+ progress: 0,
52
+ } );
53
+
54
+ expect(
55
+ screen.getByText( 'Failed to insert media.\nTap for more info.' )
56
+ ).toBeVisible();
57
+ } );
58
+ } );
@@ -2,6 +2,7 @@
2
2
  * External dependencies
3
3
  */
4
4
  import {
5
+ act,
5
6
  fireEvent,
6
7
  getBlock,
7
8
  initializeEditor,
@@ -117,7 +118,7 @@ describe( 'Unsupported block', () => {
117
118
  screen.getByTestId( 'bottom-sheet' ),
118
119
  MODAL_DISMISS_EVENT
119
120
  );
120
- jest.runOnlyPendingTimers();
121
+ act( () => jest.runOnlyPendingTimers() );
121
122
  } );
122
123
  expect( requestUnsupportedBlockFallback ).toHaveBeenCalled();
123
124
  } );
@@ -672,7 +672,7 @@ function Navigation( {
672
672
  panelId={ clientId }
673
673
  { ...colorGradientSettings }
674
674
  gradients={ [] }
675
- disableCustomGradients={ true }
675
+ disableCustomGradients
676
676
  />
677
677
  { enableContrastChecking && (
678
678
  <>
@@ -288,7 +288,7 @@ describe( 'NavigationMenuSelector', () => {
288
288
  rerender(
289
289
  <NavigationMenuSelector
290
290
  onCreateNew={ handler }
291
- createNavigationMenuIsSuccess={ true }
291
+ createNavigationMenuIsSuccess
292
292
  />
293
293
  );
294
294
 
@@ -475,7 +475,7 @@ describe( 'NavigationMenuSelector', () => {
475
475
  // // Simulate the menu being created and component being re-rendered.
476
476
  rerender(
477
477
  <NavigationMenuSelector
478
- createNavigationMenuIsSuccess={ true } // classic menu import creates a Navigation menu.
478
+ createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
479
479
  />
480
480
  );
481
481
 
@@ -616,7 +616,7 @@ describe( 'NavigationMenuSelector', () => {
616
616
  // Simulate the menu being created and component being re-rendered.
617
617
  rerender(
618
618
  <NavigationMenuSelector
619
- createNavigationMenuIsSuccess={ true } // classic menu import creates a Navigation menu.
619
+ createNavigationMenuIsSuccess // classic menu import creates a Navigation menu.
620
620
  />
621
621
  );
622
622
 
@@ -544,7 +544,6 @@ class WP_Navigation_Block_Renderer {
544
544
  * Gets the nav element directives.
545
545
  *
546
546
  * @param bool $is_interactive Whether the block is interactive.
547
- * @param array $attributes The block attributes.
548
547
  * @return string the directives for the navigation element.
549
548
  */
550
549
  private static function get_nav_element_directives( $is_interactive ) {
@@ -1458,13 +1457,18 @@ function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks
1458
1457
  /**
1459
1458
  * Updates the post meta with the list of ignored hooked blocks when the navigation is created or updated via the REST API.
1460
1459
  *
1461
- * @param WP_Post $post Post object.
1460
+ * @param stdClass $post Post object.
1462
1461
  */
1463
1462
  function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1464
1463
  // We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
1465
1464
  // all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
1466
1465
  $blocks = parse_blocks( $post->post_content );
1467
- $markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, $post );
1466
+
1467
+ // Block Hooks logic requires a `WP_Post` object (rather than the `stdClass` with the updates that
1468
+ // we're getting from the `rest_pre_insert_wp_navigation` filter) as its second argument (to be
1469
+ // used as context for hooked blocks insertion).
1470
+ // We thus have to look it up from the DB,based on `$post->ID`.
1471
+ $markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, get_post( $post->ID ) );
1468
1472
 
1469
1473
  $root_nav_block = parse_blocks( $markup )[0];
1470
1474
  $ignored_hooked_blocks = isset( $root_nav_block['attrs']['metadata']['ignoredHookedBlocks'] )
@@ -1480,14 +1484,8 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
1480
1484
  update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
1481
1485
  }
1482
1486
 
1483
- $serialized_inner_blocks = block_core_navigation_remove_serialized_parent_block( $markup );
1484
-
1485
- wp_update_post(
1486
- array(
1487
- 'ID' => $post->ID,
1488
- 'post_content' => $serialized_inner_blocks,
1489
- )
1490
- );
1487
+ $post->post_content = block_core_navigation_remove_serialized_parent_block( $markup );
1488
+ return $post;
1491
1489
  }
1492
1490
 
1493
1491
  // Before adding our filter, we verify if it's already added in Core.
@@ -1497,8 +1495,15 @@ $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ig
1497
1495
 
1498
1496
  // Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
1499
1497
  // that are not present in Gutenberg's WP 6.5 compatibility layer.
1500
- if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1501
- add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
1498
+ if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_pre_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1499
+ add_filter( 'rest_pre_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10 );
1500
+ }
1501
+
1502
+ // Previous versions of Gutenberg and WordPress 6.5 Betas were attaching the block_core_navigation_update_ignore_hooked_blocks_meta
1503
+ // function to the `rest_insert_wp_navigation` _action_ (rather than the `rest_pre_insert_wp_navigation` _filter_).
1504
+ // To avoid collisions, we need to remove the filter from that action if it's present.
1505
+ if ( has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
1506
+ remove_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback, 10 );
1502
1507
  }
1503
1508
 
1504
1509
  /**
@@ -137,7 +137,7 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
137
137
  clientId={ clientId }
138
138
  isAppender={ false }
139
139
  prioritizePatterns={ false }
140
- selectBlockOnInsert={ true }
140
+ selectBlockOnInsert
141
141
  hasSearch={ false }
142
142
  onSelect={ onSelectBlock }
143
143
  />
@@ -247,7 +247,7 @@ export function LinkUI( props ) {
247
247
  hasTextControl
248
248
  hasRichPreviews
249
249
  value={ link }
250
- showInitialSuggestions={ true }
250
+ showInitialSuggestions
251
251
  withCreateSuggestion={ userCanCreate }
252
252
  createSuggestion={ handleCreate }
253
253
  createSuggestionButtonText={ ( searchTerm ) => {
@@ -65,7 +65,7 @@ function ParagraphBlock( {
65
65
  identifier="content"
66
66
  tagName="p"
67
67
  value={ content }
68
- deleteEnter={ true }
68
+ deleteEnter
69
69
  style={ styles }
70
70
  onChange={ ( nextContent ) => {
71
71
  setAttributes( {