@wordpress/block-library 8.29.0 → 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 (347) hide show
  1. package/CHANGELOG.md +2 -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/block/deprecated.js +71 -11
  7. package/build/block/deprecated.js.map +1 -1
  8. package/build/block/edit.js +49 -24
  9. package/build/block/edit.js.map +1 -1
  10. package/build/button/edit.js +2 -2
  11. package/build/button/edit.js.map +1 -1
  12. package/build/buttons/edit.native.js.map +1 -1
  13. package/build/buttons/transforms.js +16 -2
  14. package/build/buttons/transforms.js.map +1 -1
  15. package/build/code/transforms.js +17 -6
  16. package/build/code/transforms.js.map +1 -1
  17. package/build/columns/edit.js +3 -2
  18. package/build/columns/edit.js.map +1 -1
  19. package/build/comment-author-avatar/edit.js +1 -1
  20. package/build/comment-author-avatar/edit.js.map +1 -1
  21. package/build/cover/edit/block-controls.js +14 -3
  22. package/build/cover/edit/block-controls.js.map +1 -1
  23. package/build/cover/edit/index.js.map +1 -1
  24. package/build/cover/edit/inspector-controls.js.map +1 -1
  25. package/build/cover/edit/resizable-cover-popover.js +0 -6
  26. package/build/cover/edit/resizable-cover-popover.js.map +1 -1
  27. package/build/cover/edit.native.js.map +1 -1
  28. package/build/file/deprecated.js.map +1 -1
  29. package/build/file/edit.js +6 -13
  30. package/build/file/edit.js.map +1 -1
  31. package/build/file/edit.native.js.map +1 -1
  32. package/build/file/save.js.map +1 -1
  33. package/build/form-input/edit.js +1 -1
  34. package/build/form-input/edit.js.map +1 -1
  35. package/build/gallery/edit.js.map +1 -1
  36. package/build/gallery/gallery.native.js.map +1 -1
  37. package/build/gallery/v1/edit.js.map +1 -1
  38. package/build/gallery/v1/gallery.native.js.map +1 -1
  39. package/build/heading/transforms.js +17 -4
  40. package/build/heading/transforms.js.map +1 -1
  41. package/build/image/edit.js +8 -4
  42. package/build/image/edit.js.map +1 -1
  43. package/build/image/edit.native.js.map +1 -1
  44. package/build/image/image.js +22 -8
  45. package/build/image/image.js.map +1 -1
  46. package/build/latest-posts/edit.native.js.map +1 -1
  47. package/build/list/ordered-list-settings.js +1 -1
  48. package/build/list/ordered-list-settings.js.map +1 -1
  49. package/build/list-item/edit.js +1 -3
  50. package/build/list-item/edit.js.map +1 -1
  51. package/build/list-item/edit.native.js.map +1 -1
  52. package/build/list-item/hooks/index.js +0 -7
  53. package/build/list-item/hooks/index.js.map +1 -1
  54. package/build/list-item/hooks/use-indent-list-item.js +1 -0
  55. package/build/list-item/hooks/use-indent-list-item.js.map +1 -1
  56. package/build/list-item/hooks/use-outdent-list-item.js +1 -0
  57. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  58. package/build/list-item/hooks/use-space.js +16 -7
  59. package/build/list-item/hooks/use-space.js.map +1 -1
  60. package/build/list-item/index.js +4 -1
  61. package/build/list-item/index.js.map +1 -1
  62. package/build/media-text/media-container.native.js +1 -1
  63. package/build/media-text/media-container.native.js.map +1 -1
  64. package/build/navigation/edit/index.js.map +1 -1
  65. package/build/navigation-link/link-ui.js.map +1 -1
  66. package/build/paragraph/edit.native.js.map +1 -1
  67. package/build/pattern/edit.js +11 -0
  68. package/build/pattern/edit.js.map +1 -1
  69. package/build/post-excerpt/edit.js.map +1 -1
  70. package/build/post-featured-image/dimension-controls.js.map +1 -1
  71. package/build/post-featured-image/edit.js +8 -11
  72. package/build/post-featured-image/edit.js.map +1 -1
  73. package/build/post-navigation-link/edit.js.map +1 -1
  74. package/build/post-title/edit.js +2 -2
  75. package/build/post-title/edit.js.map +1 -1
  76. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  77. package/build/query/utils.js +7 -5
  78. package/build/query/utils.js.map +1 -1
  79. package/build/query-pagination-next/edit.js.map +1 -1
  80. package/build/query-pagination-previous/edit.js.map +1 -1
  81. package/build/quote/deprecated.js +111 -12
  82. package/build/quote/deprecated.js.map +1 -1
  83. package/build/quote/edit.js +5 -5
  84. package/build/quote/edit.js.map +1 -1
  85. package/build/quote/index.js +1 -1
  86. package/build/quote/index.js.map +1 -1
  87. package/build/quote/save.js +2 -2
  88. package/build/quote/save.js.map +1 -1
  89. package/build/read-more/edit.js.map +1 -1
  90. package/build/search/edit.js +1 -1
  91. package/build/search/edit.js.map +1 -1
  92. package/build/search/edit.native.js.map +1 -1
  93. package/build/site-logo/edit.js +7 -2
  94. package/build/site-logo/edit.js.map +1 -1
  95. package/build/site-title/{edit/index.js → edit.js} +1 -1
  96. package/build/site-title/edit.js.map +1 -0
  97. package/build/social-link/edit.js.map +1 -1
  98. package/build/social-links/edit.native.js.map +1 -1
  99. package/build/spacer/edit.js.map +1 -1
  100. package/build/table-of-contents/edit.js.map +1 -1
  101. package/build/template-part/edit/index.js +53 -1
  102. package/build/template-part/edit/index.js.map +1 -1
  103. package/build/template-part/edit/selection-modal.js +2 -8
  104. package/build/template-part/edit/selection-modal.js.map +1 -1
  105. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js +30 -0
  106. package/build/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  107. package/build/utils/caption.js +15 -5
  108. package/build/utils/caption.js.map +1 -1
  109. package/build/utils/get-transformed-metadata.js +57 -0
  110. package/build/utils/get-transformed-metadata.js.map +1 -0
  111. package/build/utils/hooks.js +55 -4
  112. package/build/utils/hooks.js.map +1 -1
  113. package/build/video/edit-common-settings.js.map +1 -1
  114. package/build/video/edit.js +7 -16
  115. package/build/video/edit.js.map +1 -1
  116. package/build/video/edit.native.js +2 -7
  117. package/build/video/edit.native.js.map +1 -1
  118. package/build-module/audio/edit.js +10 -20
  119. package/build-module/audio/edit.js.map +1 -1
  120. package/build-module/audio/edit.native.js.map +1 -1
  121. package/build-module/avatar/edit.js.map +1 -1
  122. package/build-module/block/deprecated.js +71 -11
  123. package/build-module/block/deprecated.js.map +1 -1
  124. package/build-module/block/edit.js +49 -24
  125. package/build-module/block/edit.js.map +1 -1
  126. package/build-module/button/edit.js +3 -3
  127. package/build-module/button/edit.js.map +1 -1
  128. package/build-module/buttons/edit.native.js.map +1 -1
  129. package/build-module/buttons/transforms.js +16 -2
  130. package/build-module/buttons/transforms.js.map +1 -1
  131. package/build-module/code/transforms.js +17 -6
  132. package/build-module/code/transforms.js.map +1 -1
  133. package/build-module/columns/edit.js +3 -2
  134. package/build-module/columns/edit.js.map +1 -1
  135. package/build-module/comment-author-avatar/edit.js +1 -1
  136. package/build-module/comment-author-avatar/edit.js.map +1 -1
  137. package/build-module/cover/edit/block-controls.js +15 -4
  138. package/build-module/cover/edit/block-controls.js.map +1 -1
  139. package/build-module/cover/edit/index.js.map +1 -1
  140. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  141. package/build-module/cover/edit/resizable-cover-popover.js +1 -7
  142. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -1
  143. package/build-module/cover/edit.native.js.map +1 -1
  144. package/build-module/file/deprecated.js.map +1 -1
  145. package/build-module/file/edit.js +7 -14
  146. package/build-module/file/edit.js.map +1 -1
  147. package/build-module/file/edit.native.js.map +1 -1
  148. package/build-module/file/save.js.map +1 -1
  149. package/build-module/form-input/edit.js +1 -1
  150. package/build-module/form-input/edit.js.map +1 -1
  151. package/build-module/gallery/edit.js.map +1 -1
  152. package/build-module/gallery/gallery.native.js.map +1 -1
  153. package/build-module/gallery/v1/edit.js.map +1 -1
  154. package/build-module/gallery/v1/gallery.native.js.map +1 -1
  155. package/build-module/heading/transforms.js +17 -4
  156. package/build-module/heading/transforms.js.map +1 -1
  157. package/build-module/image/edit.js +9 -5
  158. package/build-module/image/edit.js.map +1 -1
  159. package/build-module/image/edit.native.js.map +1 -1
  160. package/build-module/image/image.js +23 -9
  161. package/build-module/image/image.js.map +1 -1
  162. package/build-module/latest-posts/edit.native.js.map +1 -1
  163. package/build-module/list/ordered-list-settings.js +1 -1
  164. package/build-module/list/ordered-list-settings.js.map +1 -1
  165. package/build-module/list-item/edit.js +2 -4
  166. package/build-module/list-item/edit.js.map +1 -1
  167. package/build-module/list-item/edit.native.js.map +1 -1
  168. package/build-module/list-item/hooks/index.js +0 -1
  169. package/build-module/list-item/hooks/index.js.map +1 -1
  170. package/build-module/list-item/hooks/use-indent-list-item.js +1 -0
  171. package/build-module/list-item/hooks/use-indent-list-item.js.map +1 -1
  172. package/build-module/list-item/hooks/use-outdent-list-item.js +1 -0
  173. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  174. package/build-module/list-item/hooks/use-space.js +17 -8
  175. package/build-module/list-item/hooks/use-space.js.map +1 -1
  176. package/build-module/list-item/index.js +4 -1
  177. package/build-module/list-item/index.js.map +1 -1
  178. package/build-module/media-text/media-container.native.js +1 -1
  179. package/build-module/media-text/media-container.native.js.map +1 -1
  180. package/build-module/navigation/edit/index.js.map +1 -1
  181. package/build-module/navigation-link/link-ui.js.map +1 -1
  182. package/build-module/paragraph/edit.native.js.map +1 -1
  183. package/build-module/pattern/edit.js +11 -0
  184. package/build-module/pattern/edit.js.map +1 -1
  185. package/build-module/post-excerpt/edit.js.map +1 -1
  186. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  187. package/build-module/post-featured-image/edit.js +9 -12
  188. package/build-module/post-featured-image/edit.js.map +1 -1
  189. package/build-module/post-navigation-link/edit.js.map +1 -1
  190. package/build-module/post-title/edit.js +2 -2
  191. package/build-module/post-title/edit.js.map +1 -1
  192. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  193. package/build-module/query/utils.js +7 -5
  194. package/build-module/query/utils.js.map +1 -1
  195. package/build-module/query-pagination-next/edit.js.map +1 -1
  196. package/build-module/query-pagination-previous/edit.js.map +1 -1
  197. package/build-module/quote/deprecated.js +112 -13
  198. package/build-module/quote/deprecated.js.map +1 -1
  199. package/build-module/quote/edit.js +5 -5
  200. package/build-module/quote/edit.js.map +1 -1
  201. package/build-module/quote/index.js +1 -1
  202. package/build-module/quote/index.js.map +1 -1
  203. package/build-module/quote/save.js +2 -2
  204. package/build-module/quote/save.js.map +1 -1
  205. package/build-module/read-more/edit.js.map +1 -1
  206. package/build-module/search/edit.js +1 -1
  207. package/build-module/search/edit.js.map +1 -1
  208. package/build-module/search/edit.native.js.map +1 -1
  209. package/build-module/site-logo/edit.js +7 -2
  210. package/build-module/site-logo/edit.js.map +1 -1
  211. package/build-module/site-title/{edit/index.js → edit.js} +1 -1
  212. package/build-module/site-title/edit.js.map +1 -0
  213. package/build-module/social-link/edit.js.map +1 -1
  214. package/build-module/social-links/edit.native.js.map +1 -1
  215. package/build-module/spacer/edit.js.map +1 -1
  216. package/build-module/table-of-contents/edit.js.map +1 -1
  217. package/build-module/template-part/edit/index.js +57 -5
  218. package/build-module/template-part/edit/index.js.map +1 -1
  219. package/build-module/template-part/edit/selection-modal.js +2 -8
  220. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  221. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js +24 -0
  222. package/build-module/template-part/edit/utils/map-template-part-to-block-pattern.js.map +1 -0
  223. package/build-module/utils/caption.js +13 -3
  224. package/build-module/utils/caption.js.map +1 -1
  225. package/build-module/utils/get-transformed-metadata.js +51 -0
  226. package/build-module/utils/get-transformed-metadata.js.map +1 -0
  227. package/build-module/utils/hooks.js +54 -3
  228. package/build-module/utils/hooks.js.map +1 -1
  229. package/build-module/video/edit-common-settings.js.map +1 -1
  230. package/build-module/video/edit.js +10 -19
  231. package/build-module/video/edit.js.map +1 -1
  232. package/build-module/video/edit.native.js +2 -7
  233. package/build-module/video/edit.native.js.map +1 -1
  234. package/build-style/common-rtl.css +1 -0
  235. package/build-style/common.css +1 -0
  236. package/build-style/cover/style-rtl.css +2 -1
  237. package/build-style/cover/style.css +2 -1
  238. package/build-style/editor-rtl.css +4 -1
  239. package/build-style/editor.css +4 -1
  240. package/build-style/group/editor-rtl.css +1 -1
  241. package/build-style/group/editor.css +1 -1
  242. package/build-style/image/editor-rtl.css +3 -0
  243. package/build-style/image/editor.css +3 -0
  244. package/build-style/search/style-rtl.css +2 -0
  245. package/build-style/search/style.css +2 -0
  246. package/build-style/style-rtl.css +4 -1
  247. package/build-style/style.css +4 -1
  248. package/package.json +34 -34
  249. package/src/audio/edit.js +9 -19
  250. package/src/audio/edit.native.js +3 -3
  251. package/src/avatar/edit.js +1 -1
  252. package/src/block/deprecated.js +76 -11
  253. package/src/block/edit.js +64 -19
  254. package/src/block/index.php +23 -12
  255. package/src/button/edit.js +4 -3
  256. package/src/buttons/edit.native.js +1 -1
  257. package/src/buttons/transforms.js +14 -4
  258. package/src/calendar/index.php +5 -0
  259. package/src/code/transforms.js +20 -5
  260. package/src/columns/edit.js +3 -2
  261. package/src/comment-author-avatar/edit.js +1 -1
  262. package/src/comments/index.php +2 -0
  263. package/src/cover/edit/block-controls.js +16 -2
  264. package/src/cover/edit/index.js +2 -2
  265. package/src/cover/edit/inspector-controls.js +1 -1
  266. package/src/cover/edit/resizable-cover-popover.js +1 -6
  267. package/src/cover/edit.native.js +1 -1
  268. package/src/cover/style.scss +3 -2
  269. package/src/file/deprecated.js +3 -3
  270. package/src/file/edit.js +8 -15
  271. package/src/file/edit.native.js +4 -4
  272. package/src/file/save.js +1 -1
  273. package/src/footnotes/index.php +1 -1
  274. package/src/form-input/edit.js +1 -1
  275. package/src/gallery/edit.js +3 -3
  276. package/src/gallery/gallery.native.js +1 -1
  277. package/src/gallery/test/index.native.js +1 -1
  278. package/src/gallery/v1/edit.js +2 -2
  279. package/src/gallery/v1/gallery.native.js +1 -1
  280. package/src/group/editor.scss +1 -1
  281. package/src/heading/transforms.js +27 -8
  282. package/src/image/edit.js +13 -5
  283. package/src/image/edit.native.js +1 -1
  284. package/src/image/editor.scss +6 -0
  285. package/src/image/image.js +34 -22
  286. package/src/latest-posts/edit.native.js +1 -1
  287. package/src/list/ordered-list-settings.js +1 -1
  288. package/src/list-item/edit.js +1 -2
  289. package/src/list-item/edit.native.js +1 -1
  290. package/src/list-item/hooks/index.js +0 -1
  291. package/src/list-item/hooks/use-indent-list-item.js +2 -0
  292. package/src/list-item/hooks/use-outdent-list-item.js +2 -0
  293. package/src/list-item/hooks/use-space.js +16 -9
  294. package/src/list-item/index.js +3 -0
  295. package/src/media-text/media-container.native.js +5 -3
  296. package/src/media-text/test/edit.native.js +58 -0
  297. package/src/missing/test/edit-integration.native.js +2 -1
  298. package/src/navigation/edit/index.js +1 -1
  299. package/src/navigation/edit/test/navigation-menu-selector.js +3 -3
  300. package/src/navigation/index.php +26 -17
  301. package/src/navigation-link/link-ui.js +2 -2
  302. package/src/paragraph/edit.native.js +1 -1
  303. package/src/paragraph/test/edit.native.js +36 -0
  304. package/src/pattern/edit.js +14 -0
  305. package/src/post-excerpt/edit.js +1 -1
  306. package/src/post-featured-image/dimension-controls.js +4 -4
  307. package/src/post-featured-image/edit.js +10 -12
  308. package/src/post-navigation-link/edit.js +1 -1
  309. package/src/post-template/index.php +2 -0
  310. package/src/post-title/edit.js +49 -43
  311. package/src/query/edit/pattern-selection-modal.js +1 -1
  312. package/src/query/utils.js +6 -4
  313. package/src/query-pagination-next/edit.js +1 -1
  314. package/src/query-pagination-previous/edit.js +1 -1
  315. package/src/quote/block.json +1 -1
  316. package/src/quote/deprecated.js +110 -15
  317. package/src/quote/edit.js +5 -5
  318. package/src/quote/save.js +2 -2
  319. package/src/quote/test/__snapshots__/transforms.native.js.snap +2 -2
  320. package/src/read-more/edit.js +1 -1
  321. package/src/search/edit.js +1 -1
  322. package/src/search/edit.native.js +4 -4
  323. package/src/search/index.php +1 -1
  324. package/src/search/style.scss +2 -0
  325. package/src/site-logo/edit.js +11 -6
  326. package/src/social-link/edit.js +1 -1
  327. package/src/social-links/edit.native.js +1 -1
  328. package/src/spacer/edit.js +1 -1
  329. package/src/table-of-contents/edit.js +1 -1
  330. package/src/template-part/edit/index.js +91 -4
  331. package/src/template-part/edit/selection-modal.js +4 -8
  332. package/src/template-part/edit/utils/map-template-part-to-block-pattern.js +23 -0
  333. package/src/utils/caption.js +10 -1
  334. package/src/utils/get-transformed-metadata.js +65 -0
  335. package/src/utils/hooks.js +53 -3
  336. package/src/video/edit-common-settings.js +1 -1
  337. package/src/video/edit.js +10 -18
  338. package/src/video/edit.native.js +5 -8
  339. package/src/video/test/edit.native.js +0 -14
  340. package/build/list-item/hooks/use-copy.js +0 -39
  341. package/build/list-item/hooks/use-copy.js.map +0 -1
  342. package/build/site-title/edit/index.js.map +0 -1
  343. package/build-module/list-item/hooks/use-copy.js +0 -32
  344. package/build-module/list-item/hooks/use-copy.js.map +0 -1
  345. package/build-module/site-title/edit/index.js.map +0 -1
  346. package/src/list-item/hooks/use-copy.js +0 -38
  347. /package/src/site-title/{edit/index.js → edit.js} +0 -0
@@ -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' ) }
@@ -546,7 +546,7 @@ function GalleryEdit( props ) {
546
546
  value={ sizeSlug }
547
547
  options={ imageSizeOptions }
548
548
  onChange={ updateImagesSize }
549
- hideCancelButton={ true }
549
+ hideCancelButton
550
550
  size="__unstable-large"
551
551
  />
552
552
  ) }
@@ -556,7 +556,7 @@ function GalleryEdit( props ) {
556
556
  value={ linkTo }
557
557
  onChange={ setLinkTo }
558
558
  options={ linkOptions }
559
- hideCancelButton={ true }
559
+ hideCancelButton
560
560
  size="__unstable-large"
561
561
  />
562
562
  <ToggleControl
@@ -602,7 +602,7 @@ function GalleryEdit( props ) {
602
602
  handleUpload={ false }
603
603
  onSelect={ updateImages }
604
604
  name={ __( 'Add' ) }
605
- multiple={ true }
605
+ multiple
606
606
  mediaIds={ images
607
607
  .filter( ( image ) => image.id )
608
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 {
@@ -7,6 +7,7 @@ import { createBlock, getBlockAttributes } from '@wordpress/blocks';
7
7
  * Internal dependencies
8
8
  */
9
9
  import { getLevelFromHeadingNodeName } from './shared';
10
+ import { getTransformedMetadata } from '../utils/get-transformed-metadata';
10
11
 
11
12
  const transforms = {
12
13
  from: [
@@ -15,12 +16,20 @@ const transforms = {
15
16
  isMultiBlock: true,
16
17
  blocks: [ 'core/paragraph' ],
17
18
  transform: ( attributes ) =>
18
- attributes.map( ( { content, anchor, align: textAlign } ) =>
19
- createBlock( 'core/heading', {
20
- content,
21
- anchor,
22
- textAlign,
23
- } )
19
+ attributes.map(
20
+ ( { content, anchor, align: textAlign, metadata } ) =>
21
+ createBlock( 'core/heading', {
22
+ content,
23
+ anchor,
24
+ textAlign,
25
+ metadata: getTransformedMetadata(
26
+ metadata,
27
+ 'core/heading',
28
+ ( { content: contentBinding } ) => ( {
29
+ content: contentBinding,
30
+ } )
31
+ ),
32
+ } )
24
33
  ),
25
34
  },
26
35
  {
@@ -82,8 +91,18 @@ const transforms = {
82
91
  isMultiBlock: true,
83
92
  blocks: [ 'core/paragraph' ],
84
93
  transform: ( attributes ) =>
85
- attributes.map( ( { content, textAlign: align } ) =>
86
- createBlock( 'core/paragraph', { content, align } )
94
+ attributes.map( ( { content, textAlign: align, metadata } ) =>
95
+ createBlock( 'core/paragraph', {
96
+ content,
97
+ align,
98
+ metadata: getTransformedMetadata(
99
+ metadata,
100
+ 'core/paragraph',
101
+ ( { content: contentBinding } ) => ( {
102
+ content: contentBinding,
103
+ } )
104
+ ),
105
+ } )
87
106
  ),
88
107
  },
89
108
  ],
package/src/image/edit.js CHANGED
@@ -7,6 +7,7 @@ import classnames from 'classnames';
7
7
  * WordPress dependencies
8
8
  */
9
9
  import { getBlobByURL, isBlobURL, revokeBlobURL } from '@wordpress/blob';
10
+ import { store as blocksStore } from '@wordpress/blocks';
10
11
  import { Placeholder } from '@wordpress/components';
11
12
  import { useDispatch, useSelect } from '@wordpress/data';
12
13
  import {
@@ -19,7 +20,7 @@ import {
19
20
  useBlockEditingMode,
20
21
  } from '@wordpress/block-editor';
21
22
  import { useEffect, useRef, useState } from '@wordpress/element';
22
- import { __ } from '@wordpress/i18n';
23
+ import { __, sprintf } from '@wordpress/i18n';
23
24
  import { image as icon, plugins as pluginsIcon } from '@wordpress/icons';
24
25
  import { store as noticesStore } from '@wordpress/notices';
25
26
 
@@ -335,14 +336,14 @@ export function ImageEdit( {
335
336
  } );
336
337
 
337
338
  // Much of this description is duplicated from MediaPlaceholder.
338
- const { lockUrlControls = false } = useSelect(
339
+ const { lockUrlControls = false, lockUrlControlsMessage } = useSelect(
339
340
  ( select ) => {
340
341
  if ( ! isSingleSelected ) {
341
342
  return {};
342
343
  }
343
344
 
344
345
  const blockBindingsSource = unlock(
345
- select( blockEditorStore )
346
+ select( blocksStore )
346
347
  ).getBlockBindingsSource( metadata?.bindings?.url?.source );
347
348
 
348
349
  return {
@@ -350,6 +351,13 @@ export function ImageEdit( {
350
351
  !! metadata?.bindings?.url &&
351
352
  ( ! blockBindingsSource ||
352
353
  blockBindingsSource?.lockAttributesEditing ),
354
+ lockUrlControlsMessage: blockBindingsSource?.label
355
+ ? sprintf(
356
+ /* translators: %s: Label of the bindings source. */
357
+ __( 'Connected to %s' ),
358
+ blockBindingsSource.label
359
+ )
360
+ : __( 'Connected to dynamic data' ),
353
361
  };
354
362
  },
355
363
  [ isSingleSelected ]
@@ -361,7 +369,7 @@ export function ImageEdit( {
361
369
  [ borderProps.className ]:
362
370
  !! borderProps.className && ! isSingleSelected,
363
371
  } ) }
364
- withIllustration={ true }
372
+ withIllustration
365
373
  icon={ lockUrlControls ? pluginsIcon : icon }
366
374
  label={ __( 'Image' ) }
367
375
  instructions={
@@ -386,7 +394,7 @@ export function ImageEdit( {
386
394
  <span
387
395
  className={ 'block-bindings-media-placeholder-message' }
388
396
  >
389
- { __( 'Connected to a custom field' ) }
397
+ { lockUrlControlsMessage }
390
398
  </span>
391
399
  ) : (
392
400
  content
@@ -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.
@@ -33,7 +33,7 @@ import { useEffect, useMemo, useState, useRef } from '@wordpress/element';
33
33
  import { __, _x, sprintf, isRTL } from '@wordpress/i18n';
34
34
  import { DOWN } from '@wordpress/keycodes';
35
35
  import { getFilename } from '@wordpress/url';
36
- import { switchToBlockType } from '@wordpress/blocks';
36
+ import { switchToBlockType, store as blocksStore } from '@wordpress/blocks';
37
37
  import { crop, overlayText, upload } from '@wordpress/icons';
38
38
  import { store as noticesStore } from '@wordpress/notices';
39
39
  import { store as coreStore } from '@wordpress/core-data';
@@ -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.
@@ -410,15 +410,19 @@ export default function Image( {
410
410
  lockUrlControls = false,
411
411
  lockHrefControls = false,
412
412
  lockAltControls = false,
413
+ lockAltControlsMessage,
413
414
  lockTitleControls = false,
415
+ lockTitleControlsMessage,
416
+ lockCaption = false,
414
417
  } = useSelect(
415
418
  ( select ) => {
416
419
  if ( ! isSingleSelected ) {
417
420
  return {};
418
421
  }
419
-
420
- const { getBlockBindingsSource, getBlockParentsByBlockName } =
421
- unlock( select( blockEditorStore ) );
422
+ const { getBlockBindingsSource } = unlock( select( blocksStore ) );
423
+ const { getBlockParentsByBlockName } = unlock(
424
+ select( blockEditorStore )
425
+ );
422
426
  const {
423
427
  url: urlBinding,
424
428
  alt: altBinding,
@@ -444,14 +448,32 @@ export default function Image( {
444
448
  // Disable editing the link of the URL if the image is inside a pattern instance.
445
449
  // This is a temporary solution until we support overriding the link on the frontend.
446
450
  hasParentPattern,
451
+ lockCaption:
452
+ // Disable editing the caption if the image is inside a pattern instance.
453
+ // This is a temporary solution until we support overriding the caption on the frontend.
454
+ hasParentPattern,
447
455
  lockAltControls:
448
456
  !! altBinding &&
449
457
  ( ! altBindingSource ||
450
458
  altBindingSource?.lockAttributesEditing ),
459
+ lockAltControlsMessage: altBindingSource?.label
460
+ ? sprintf(
461
+ /* translators: %s: Label of the bindings source. */
462
+ __( 'Connected to %s' ),
463
+ altBindingSource.label
464
+ )
465
+ : __( 'Connected to dynamic data' ),
451
466
  lockTitleControls:
452
467
  !! titleBinding &&
453
468
  ( ! titleBindingSource ||
454
469
  titleBindingSource?.lockAttributesEditing ),
470
+ lockTitleControlsMessage: titleBindingSource?.label
471
+ ? sprintf(
472
+ /* translators: %s: Label of the bindings source. */
473
+ __( 'Connected to %s' ),
474
+ titleBindingSource.label
475
+ )
476
+ : __( 'Connected to dynamic data' ),
455
477
  };
456
478
  },
457
479
  [ clientId, isSingleSelected, metadata?.bindings ]
@@ -551,11 +573,7 @@ export default function Image( {
551
573
  disabled={ lockAltControls }
552
574
  help={
553
575
  lockAltControls ? (
554
- <>
555
- { __(
556
- 'Connected to a custom field'
557
- ) }
558
- </>
576
+ <>{ lockAltControlsMessage }</>
559
577
  ) : (
560
578
  <>
561
579
  <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
@@ -601,11 +619,7 @@ export default function Image( {
601
619
  disabled={ lockTitleControls }
602
620
  help={
603
621
  lockTitleControls ? (
604
- <>
605
- { __(
606
- 'Connected to a custom field'
607
- ) }
608
- </>
622
+ <>{ lockTitleControlsMessage }</>
609
623
  ) : (
610
624
  <>
611
625
  { __(
@@ -633,7 +647,7 @@ export default function Image( {
633
647
  { isSingleSelected && (
634
648
  <ToolsPanelItem
635
649
  label={ __( 'Alternative text' ) }
636
- isShownByDefault={ true }
650
+ isShownByDefault
637
651
  hasValue={ () => !! alt }
638
652
  onDeselect={ () =>
639
653
  setAttributes( { alt: undefined } )
@@ -646,11 +660,7 @@ export default function Image( {
646
660
  readOnly={ lockAltControls }
647
661
  help={
648
662
  lockAltControls ? (
649
- <>
650
- { __(
651
- 'Connected to a custom field'
652
- ) }
653
- </>
663
+ <>{ lockAltControlsMessage }</>
654
664
  ) : (
655
665
  <>
656
666
  <ExternalLink href="https://www.w3.org/WAI/tutorials/images/decision-tree">
@@ -688,7 +698,7 @@ export default function Image( {
688
698
  readOnly={ lockTitleControls }
689
699
  help={
690
700
  lockTitleControls ? (
691
- <>{ __( 'Connected to a custom field' ) }</>
701
+ <>{ lockTitleControlsMessage }</>
692
702
  ) : (
693
703
  <>
694
704
  { __(
@@ -907,6 +917,7 @@ export default function Image( {
907
917
  which causes duplicated image upload. */ }
908
918
  { ! temporaryURL && controls }
909
919
  { img }
920
+
910
921
  <Caption
911
922
  attributes={ attributes }
912
923
  setAttributes={ setAttributes }
@@ -914,6 +925,7 @@ export default function Image( {
914
925
  insertBlocksAfter={ insertBlocksAfter }
915
926
  label={ __( 'Image caption text' ) }
916
927
  showToolbarButton={ isSingleSelected && hasNonContentControls }
928
+ disableEditing={ lockCaption }
917
929
  />
918
930
  </>
919
931
  );
@@ -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' ) }
@@ -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' ) }
@@ -29,7 +29,6 @@ import {
29
29
  useOutdentListItem,
30
30
  useSplit,
31
31
  useMerge,
32
- useCopy,
33
32
  } from './hooks';
34
33
  import { convertToListItems } from './utils';
35
34
 
@@ -79,7 +78,7 @@ export default function ListItemEdit( {
79
78
  mergeBlocks,
80
79
  } ) {
81
80
  const { placeholder, content } = attributes;
82
- const blockProps = useBlockProps( { ref: useCopy( clientId ) } );
81
+ const blockProps = useBlockProps();
83
82
  const innerBlocksProps = useInnerBlocksProps( blockProps, {
84
83
  renderAppender: false,
85
84
  __unstableDisableDropZone: true,
@@ -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>
@@ -4,4 +4,3 @@ export { default as useEnter } from './use-enter';
4
4
  export { default as useSpace } from './use-space';
5
5
  export { default as useSplit } from './use-split';
6
6
  export { default as useMerge } from './use-merge';
7
- export { default as useCopy } from './use-copy';
@@ -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
 
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { listItem as icon } from '@wordpress/icons';
5
+ import { privateApis } from '@wordpress/block-editor';
5
6
 
6
7
  /**
7
8
  * Internal dependencies
@@ -11,6 +12,7 @@ import metadata from './block.json';
11
12
  import edit from './edit';
12
13
  import save from './save';
13
14
  import transforms from './transforms';
15
+ import { unlock } from '../lock-unlock';
14
16
 
15
17
  const { name } = metadata;
16
18
 
@@ -27,6 +29,7 @@ export const settings = {
27
29
  };
28
30
  },
29
31
  transforms,
32
+ [ unlock( privateApis ).requiresWrapperOnCopy ]: true,
30
33
  };
31
34
 
32
35
  export const init = () => initBlock( { name, metadata, settings } );
@@ -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
  <>