@wordpress/block-library 7.14.2 → 7.15.1-next.4d3b314fd5.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 (235) hide show
  1. package/CHANGELOG.md +3 -0
  2. package/build/avatar/index.js +1 -1
  3. package/build/block/edit.native.js +1 -1
  4. package/build/block/edit.native.js.map +1 -1
  5. package/build/buttons/edit.native.js +1 -3
  6. package/build/buttons/edit.native.js.map +1 -1
  7. package/build/calendar/index.js +9 -0
  8. package/build/calendar/index.js.map +1 -1
  9. package/build/code/index.js +1 -1
  10. package/build/code/index.js.map +1 -1
  11. package/build/comments/edit/comments-legacy.js +1 -1
  12. package/build/comments/edit/comments-legacy.js.map +1 -1
  13. package/build/comments-pagination-next/index.js +1 -1
  14. package/build/comments-pagination-numbers/index.js +8 -1
  15. package/build/comments-pagination-numbers/index.js.map +1 -1
  16. package/build/comments-pagination-previous/index.js +1 -1
  17. package/build/comments-title/edit.js +1 -1
  18. package/build/comments-title/edit.js.map +1 -1
  19. package/build/cover/edit/use-cover-is-dark.js +10 -7
  20. package/build/cover/edit/use-cover-is-dark.js.map +1 -1
  21. package/build/cover/index.js +9 -2
  22. package/build/cover/index.js.map +1 -1
  23. package/build/embed/deprecated.js +12 -6
  24. package/build/embed/deprecated.js.map +1 -1
  25. package/build/embed/index.js +12 -6
  26. package/build/embed/index.js.map +1 -1
  27. package/build/embed/transforms.js +12 -6
  28. package/build/embed/transforms.js.map +1 -1
  29. package/build/embed/util.js +12 -6
  30. package/build/embed/util.js.map +1 -1
  31. package/build/embed/variations.js +1 -1
  32. package/build/embed/variations.js.map +1 -1
  33. package/build/freeform/edit.js +5 -8
  34. package/build/freeform/edit.js.map +1 -1
  35. package/build/gallery/deprecated.js +4 -4
  36. package/build/gallery/deprecated.js.map +1 -1
  37. package/build/gallery/gallery.js +2 -28
  38. package/build/gallery/gallery.js.map +1 -1
  39. package/build/list-item/edit.js +2 -1
  40. package/build/list-item/edit.js.map +1 -1
  41. package/build/missing/edit.js +9 -2
  42. package/build/missing/edit.js.map +1 -1
  43. package/build/more/edit.js +1 -1
  44. package/build/more/edit.js.map +1 -1
  45. package/build/navigation/menu-items-to-blocks.js +16 -6
  46. package/build/navigation/menu-items-to-blocks.js.map +1 -1
  47. package/build/paragraph/drop-zone.js +99 -0
  48. package/build/paragraph/drop-zone.js.map +1 -0
  49. package/build/paragraph/edit.js +11 -3
  50. package/build/paragraph/edit.js.map +1 -1
  51. package/build/post-content/edit.js +6 -1
  52. package/build/post-content/edit.js.map +1 -1
  53. package/build/post-excerpt/edit.js +1 -1
  54. package/build/post-excerpt/edit.js.map +1 -1
  55. package/build/post-navigation-link/edit.js +35 -4
  56. package/build/post-navigation-link/edit.js.map +1 -1
  57. package/build/post-navigation-link/index.js +6 -1
  58. package/build/post-navigation-link/index.js.map +1 -1
  59. package/build/post-template/edit.js +13 -28
  60. package/build/post-template/edit.js.map +1 -1
  61. package/build/query/edit/inspector-controls/index.js +4 -8
  62. package/build/query/edit/inspector-controls/index.js.map +1 -1
  63. package/build/query/edit/inspector-controls/sticky-control.js +1 -1
  64. package/build/query/edit/inspector-controls/sticky-control.js.map +1 -1
  65. package/build/query/edit/query-placeholder.js +2 -2
  66. package/build/query/edit/query-placeholder.js.map +1 -1
  67. package/build/query-title/edit.js +1 -1
  68. package/build/query-title/edit.js.map +1 -1
  69. package/build/quote/transforms.js +2 -2
  70. package/build/quote/transforms.js.map +1 -1
  71. package/build/read-more/edit.js +1 -1
  72. package/build/read-more/edit.js.map +1 -1
  73. package/build/site-tagline/index.js +1 -1
  74. package/build/social-links/edit.native.js +1 -0
  75. package/build/social-links/edit.native.js.map +1 -1
  76. package/build/template-part/edit/index.js +2 -2
  77. package/build/template-part/edit/index.js.map +1 -1
  78. package/build-module/avatar/index.js +1 -1
  79. package/build-module/block/edit.native.js +1 -1
  80. package/build-module/block/edit.native.js.map +1 -1
  81. package/build-module/buttons/edit.native.js +1 -2
  82. package/build-module/buttons/edit.native.js.map +1 -1
  83. package/build-module/calendar/index.js +9 -0
  84. package/build-module/calendar/index.js.map +1 -1
  85. package/build-module/code/index.js +1 -1
  86. package/build-module/code/index.js.map +1 -1
  87. package/build-module/comments/edit/comments-legacy.js +1 -1
  88. package/build-module/comments/edit/comments-legacy.js.map +1 -1
  89. package/build-module/comments-pagination-next/index.js +1 -1
  90. package/build-module/comments-pagination-numbers/index.js +8 -1
  91. package/build-module/comments-pagination-numbers/index.js.map +1 -1
  92. package/build-module/comments-pagination-previous/index.js +1 -1
  93. package/build-module/comments-title/edit.js +1 -1
  94. package/build-module/comments-title/edit.js.map +1 -1
  95. package/build-module/cover/edit/use-cover-is-dark.js +9 -4
  96. package/build-module/cover/edit/use-cover-is-dark.js.map +1 -1
  97. package/build-module/cover/index.js +9 -2
  98. package/build-module/cover/index.js.map +1 -1
  99. package/build-module/embed/deprecated.js +12 -6
  100. package/build-module/embed/deprecated.js.map +1 -1
  101. package/build-module/embed/index.js +12 -6
  102. package/build-module/embed/index.js.map +1 -1
  103. package/build-module/embed/transforms.js +12 -6
  104. package/build-module/embed/transforms.js.map +1 -1
  105. package/build-module/embed/util.js +12 -6
  106. package/build-module/embed/util.js.map +1 -1
  107. package/build-module/embed/variations.js +1 -1
  108. package/build-module/embed/variations.js.map +1 -1
  109. package/build-module/freeform/edit.js +3 -6
  110. package/build-module/freeform/edit.js.map +1 -1
  111. package/build-module/gallery/deprecated.js +4 -4
  112. package/build-module/gallery/deprecated.js.map +1 -1
  113. package/build-module/gallery/gallery.js +2 -29
  114. package/build-module/gallery/gallery.js.map +1 -1
  115. package/build-module/list-item/edit.js +2 -1
  116. package/build-module/list-item/edit.js.map +1 -1
  117. package/build-module/missing/edit.js +11 -4
  118. package/build-module/missing/edit.js.map +1 -1
  119. package/build-module/more/edit.js +1 -1
  120. package/build-module/more/edit.js.map +1 -1
  121. package/build-module/navigation/menu-items-to-blocks.js +16 -6
  122. package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
  123. package/build-module/paragraph/drop-zone.js +88 -0
  124. package/build-module/paragraph/drop-zone.js.map +1 -0
  125. package/build-module/paragraph/edit.js +10 -3
  126. package/build-module/paragraph/edit.js.map +1 -1
  127. package/build-module/post-content/edit.js +6 -1
  128. package/build-module/post-content/edit.js.map +1 -1
  129. package/build-module/post-excerpt/edit.js +1 -1
  130. package/build-module/post-excerpt/edit.js.map +1 -1
  131. package/build-module/post-navigation-link/edit.js +37 -6
  132. package/build-module/post-navigation-link/edit.js.map +1 -1
  133. package/build-module/post-navigation-link/index.js +6 -1
  134. package/build-module/post-navigation-link/index.js.map +1 -1
  135. package/build-module/post-template/edit.js +14 -29
  136. package/build-module/post-template/edit.js.map +1 -1
  137. package/build-module/query/edit/inspector-controls/index.js +2 -6
  138. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  139. package/build-module/query/edit/inspector-controls/sticky-control.js +1 -1
  140. package/build-module/query/edit/inspector-controls/sticky-control.js.map +1 -1
  141. package/build-module/query/edit/query-placeholder.js +2 -2
  142. package/build-module/query/edit/query-placeholder.js.map +1 -1
  143. package/build-module/query-title/edit.js +1 -1
  144. package/build-module/query-title/edit.js.map +1 -1
  145. package/build-module/quote/transforms.js +2 -2
  146. package/build-module/quote/transforms.js.map +1 -1
  147. package/build-module/read-more/edit.js +1 -1
  148. package/build-module/read-more/edit.js.map +1 -1
  149. package/build-module/site-tagline/index.js +1 -1
  150. package/build-module/social-links/edit.native.js +1 -0
  151. package/build-module/social-links/edit.native.js.map +1 -1
  152. package/build-module/template-part/edit/index.js +3 -3
  153. package/build-module/template-part/edit/index.js.map +1 -1
  154. package/build-style/calendar/style-rtl.css +21 -12
  155. package/build-style/calendar/style.css +21 -12
  156. package/build-style/classic-rtl.css +85 -0
  157. package/build-style/classic.css +85 -0
  158. package/build-style/editor-rtl.css +41 -2
  159. package/build-style/editor.css +41 -2
  160. package/build-style/group/editor-rtl.css +11 -1
  161. package/build-style/group/editor.css +11 -1
  162. package/build-style/image/editor-rtl.css +3 -0
  163. package/build-style/image/editor.css +3 -0
  164. package/build-style/navigation/editor-rtl.css +11 -1
  165. package/build-style/navigation/editor.css +11 -1
  166. package/build-style/paragraph/editor-rtl.css +16 -0
  167. package/build-style/paragraph/editor.css +16 -0
  168. package/build-style/post-navigation-link/style-rtl.css +90 -0
  169. package/build-style/post-navigation-link/style.css +90 -0
  170. package/build-style/style-rtl.css +36 -12
  171. package/build-style/style.css +36 -12
  172. package/package.json +29 -29
  173. package/src/archives/index.php +4 -7
  174. package/src/avatar/block.json +1 -1
  175. package/src/block/edit.native.js +1 -1
  176. package/src/buttons/edit.native.js +1 -2
  177. package/src/buttons/test/__snapshots__/edit.native.js.snap +28 -0
  178. package/src/buttons/test/edit.native.js +170 -0
  179. package/src/calendar/block.json +9 -0
  180. package/src/calendar/index.php +22 -1
  181. package/src/calendar/style.scss +28 -15
  182. package/src/classic.scss +15 -0
  183. package/src/code/index.js +1 -1
  184. package/src/columns/test/__snapshots__/edit.native.js.snap +219 -0
  185. package/src/columns/test/edit.native.js +432 -0
  186. package/src/comment-template/index.php +18 -8
  187. package/src/comments/edit/comments-legacy.js +1 -1
  188. package/src/comments-pagination-next/block.json +1 -1
  189. package/src/comments-pagination-numbers/block.json +8 -1
  190. package/src/comments-pagination-previous/block.json +1 -1
  191. package/src/comments-title/edit.js +1 -1
  192. package/src/cover/edit/use-cover-is-dark.js +11 -7
  193. package/src/cover/index.js +8 -1
  194. package/src/cover/test/__snapshots__/edit.native.js.snap +64 -0
  195. package/src/cover/test/edit.native.js +136 -4
  196. package/src/embed/block.json +12 -6
  197. package/src/embed/test/index.native.js +1 -2
  198. package/src/embed/variations.js +1 -1
  199. package/src/freeform/edit.js +12 -10
  200. package/src/gallery/deprecated.js +4 -4
  201. package/src/gallery/gallery.js +1 -31
  202. package/src/group/test/__snapshots__/edit.native.js.snap +19 -0
  203. package/src/group/test/edit.native.js +102 -0
  204. package/src/image/editor.scss +4 -0
  205. package/src/list-item/edit.js +1 -0
  206. package/src/missing/edit.js +15 -4
  207. package/src/more/edit.js +1 -1
  208. package/src/navigation/menu-items-to-blocks.js +39 -22
  209. package/src/navigation/test/menu-items-to-blocks.js +6 -0
  210. package/src/navigation-submenu/index.php +11 -2
  211. package/src/page-list/index.php +1 -1
  212. package/src/paragraph/drop-zone.js +105 -0
  213. package/src/paragraph/edit.js +14 -1
  214. package/src/paragraph/editor.scss +20 -0
  215. package/src/post-content/edit.js +3 -1
  216. package/src/post-excerpt/edit.js +1 -1
  217. package/src/post-featured-image/index.php +11 -18
  218. package/src/post-navigation-link/block.json +6 -1
  219. package/src/post-navigation-link/edit.js +64 -3
  220. package/src/post-navigation-link/index.php +23 -0
  221. package/src/post-navigation-link/style.scss +23 -0
  222. package/src/post-template/edit.js +14 -23
  223. package/src/query/edit/inspector-controls/index.js +2 -6
  224. package/src/query/edit/inspector-controls/sticky-control.js +1 -1
  225. package/src/query/edit/query-placeholder.js +4 -1
  226. package/src/query-title/edit.js +1 -1
  227. package/src/quote/transforms.js +1 -1
  228. package/src/read-more/edit.js +1 -1
  229. package/src/site-tagline/block.json +1 -1
  230. package/src/social-links/edit.native.js +7 -1
  231. package/src/social-links/test/__snapshots__/edit.native.js.snap +57 -0
  232. package/src/social-links/test/edit.native.js +199 -0
  233. package/src/style.scss +1 -0
  234. package/src/tag-cloud/index.php +1 -8
  235. package/src/template-part/edit/index.js +60 -58
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-next",
5
- "title": "Next Page",
5
+ "title": "Comments Next Page",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays the next comment's page link.",
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-numbers",
5
- "title": "Page Numbers",
5
+ "title": "Comments Page Numbers",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays a list of page numbers for comments pagination.",
@@ -11,6 +11,13 @@
11
11
  "supports": {
12
12
  "reusable": false,
13
13
  "html": false,
14
+ "color": {
15
+ "gradients": true,
16
+ "text": false,
17
+ "__experimentalDefaultControls": {
18
+ "background": true
19
+ }
20
+ },
14
21
  "typography": {
15
22
  "fontSize": true,
16
23
  "lineHeight": true,
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://schemas.wp.org/trunk/block.json",
3
3
  "apiVersion": 2,
4
4
  "name": "core/comments-pagination-previous",
5
- "title": "Previous Page",
5
+ "title": "Comments Previous Page",
6
6
  "category": "theme",
7
7
  "parent": [ "core/comments-pagination" ],
8
8
  "description": "Displays the previous comment's page link.",
@@ -104,7 +104,7 @@ export default function Edit( {
104
104
  </InspectorControls>
105
105
  );
106
106
 
107
- const postTitle = isSiteEditor ? __( '"Post Title"' ) : `"${ rawTitle }"`;
107
+ const postTitle = isSiteEditor ? __( 'Post Title' ) : `"${ rawTitle }"`;
108
108
 
109
109
  let placeholder;
110
110
  if ( showCommentsCount && commentsCount !== undefined ) {
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * External dependencies
3
3
  */
4
- import FastAverageColor from 'fast-average-color';
4
+ import { FastAverageColor } from 'fast-average-color';
5
5
  import { colord } from 'colord';
6
6
 
7
7
  /**
@@ -41,12 +41,16 @@ export default function useCoverIsDark(
41
41
  // If opacity is lower than 50 the dominant color is the image or video color,
42
42
  // so use that color for the dark mode computation.
43
43
  if ( url && dimRatio <= 50 && elementRef.current ) {
44
- retrieveFastAverageColor().getColorAsync(
45
- elementRef.current,
46
- ( color ) => {
47
- setIsDark( color.isDark );
48
- }
49
- );
44
+ retrieveFastAverageColor()
45
+ .getColorAsync( elementRef.current, {
46
+ // Previously the default color was white, but that changed
47
+ // in v6.0.0 so it has to be manually set now.
48
+ defaultColor: [ 255, 255, 255, 255 ],
49
+ // Errors that come up don't reject the promise, so error
50
+ // logging has to be silenced with this option.
51
+ silent: process.env.NODE_ENV === 'production',
52
+ } )
53
+ .then( ( color ) => setIsDark( color.isDark ) );
50
54
  }
51
55
  }, [ url, url && dimRatio <= 50 && elementRef.current, setIsDark ] );
52
56
  useEffect( () => {
@@ -30,9 +30,16 @@ export const settings = {
30
30
  {
31
31
  name: 'core/paragraph',
32
32
  attributes: {
33
- customFontSize: 48,
34
33
  content: __( '<strong>Snow Patrol</strong>' ),
35
34
  align: 'center',
35
+ style: {
36
+ typography: {
37
+ fontSize: 48,
38
+ },
39
+ color: {
40
+ text: 'white',
41
+ },
42
+ },
36
43
  },
37
44
  },
38
45
  ],
@@ -31,3 +31,67 @@ exports[`color settings toggles between solid colors and gradients 1`] = `
31
31
  <!-- /wp:paragraph --></div></div>
32
32
  <!-- /wp:cover -->"
33
33
  `;
34
+
35
+ exports[`minimum height settings changes the height value between units 1`] = `
36
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":50,\\"minHeightUnit\\":\\"px\\",\\"isDark\\":false} -->
37
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:50px\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
38
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
39
+ <!-- /wp:paragraph --></div></div>
40
+ <!-- /wp:cover -->"
41
+ `;
42
+
43
+ exports[`minimum height settings changes the height value to 20(vw) 1`] = `
44
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":20,\\"minHeightUnit\\":\\"vw\\",\\"isDark\\":false} -->
45
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:20vw\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
46
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
47
+ <!-- /wp:paragraph --></div></div>
48
+ <!-- /wp:cover -->"
49
+ `;
50
+
51
+ exports[`minimum height settings disables the decrease button when reaching the minimum value for Pixels (px) 1`] = `
52
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":50,\\"minHeightUnit\\":\\"px\\",\\"isDark\\":false} -->
53
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:50px\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
54
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
55
+ <!-- /wp:paragraph --></div></div>
56
+ <!-- /wp:cover -->"
57
+ `;
58
+
59
+ exports[`minimum height settings disables the decrease button when reaching the minimum value for Relative to parent font size (em) 1`] = `
60
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":1,\\"minHeightUnit\\":\\"em\\",\\"isDark\\":false} -->
61
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:1em\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
62
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
63
+ <!-- /wp:paragraph --></div></div>
64
+ <!-- /wp:cover -->"
65
+ `;
66
+
67
+ exports[`minimum height settings disables the decrease button when reaching the minimum value for Relative to root font size (rem) 1`] = `
68
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":1,\\"minHeightUnit\\":\\"rem\\",\\"isDark\\":false} -->
69
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:1rem\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
70
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
71
+ <!-- /wp:paragraph --></div></div>
72
+ <!-- /wp:cover -->"
73
+ `;
74
+
75
+ exports[`minimum height settings disables the decrease button when reaching the minimum value for Viewport height (vh) 1`] = `
76
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":1,\\"minHeightUnit\\":\\"vh\\",\\"isDark\\":false} -->
77
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:1vh\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
78
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
79
+ <!-- /wp:paragraph --></div></div>
80
+ <!-- /wp:cover -->"
81
+ `;
82
+
83
+ exports[`minimum height settings disables the decrease button when reaching the minimum value for Viewport width (vw) 1`] = `
84
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":50,\\"overlayColor\\":\\"foreground\\",\\"minHeight\\":1,\\"minHeightUnit\\":\\"vw\\",\\"isDark\\":false} -->
85
+ <div class=\\"wp-block-cover is-light\\" style=\\"min-height:1vw\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
86
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
87
+ <!-- /wp:paragraph --></div></div>
88
+ <!-- /wp:cover -->"
89
+ `;
90
+
91
+ exports[`when an image is attached updates background opacity 1`] = `
92
+ "<!-- wp:cover {\\"url\\":\\"https://cldup.com/cXyG__fTLN.jpg\\",\\"id\\":10710,\\"dimRatio\\":15,\\"overlayColor\\":\\"foreground\\",\\"isDark\\":false} -->
93
+ <div class=\\"wp-block-cover is-light\\"><span aria-hidden=\\"true\\" class=\\"wp-block-cover__background has-foreground-background-color has-background-dim-20 has-background-dim\\"></span><img class=\\"wp-block-cover__image-background wp-image-10710\\" alt=\\"\\" src=\\"https://cldup.com/cXyG__fTLN.jpg\\" data-object-fit=\\"cover\\"/><div class=\\"wp-block-cover__inner-container\\"><!-- wp:paragraph {\\"align\\":\\"center\\",\\"placeholder\\":\\"Write title…\\",\\"fontSize\\":\\"large\\"} -->
94
+ <p class=\\"has-text-align-center has-large-font-size\\"></p>
95
+ <!-- /wp:paragraph --></div></div>
96
+ <!-- /wp:cover -->"
97
+ `;
@@ -9,6 +9,8 @@ import {
9
9
  fireEvent,
10
10
  waitFor,
11
11
  within,
12
+ getBlock,
13
+ openBlockSettings,
12
14
  } from 'test/helpers';
13
15
 
14
16
  /**
@@ -41,14 +43,24 @@ jest.mock( '@wordpress/compose', () => ( {
41
43
  ) ),
42
44
  } ) );
43
45
 
44
- const COVER_BLOCK_PLACEHOLDER_HTML = `<!-- wp:cover -->
45
- <div class="wp-block-cover"><span aria-hidden="true" class="has-background-dim-100 wp-block-cover__gradient-background has-background-dim"></span><div class="wp-block-cover__inner-container"></div></div>
46
+ const COVER_BLOCK_PLACEHOLDER_HTML = `<!-- wp:cover {"isDark":false} -->
47
+ <div class="wp-block-cover is-light"><span aria-hidden="true" class="wp-block-cover__background has-background-dim-100 has-background-dim"></span><div class="wp-block-cover__inner-container"></div></div>
46
48
  <!-- /wp:cover -->`;
47
- const COVER_BLOCK_SOLID_COLOR_HTML = `<!-- wp:cover {"overlayColor":"cyan-bluish-gray"} -->
48
- <div class="wp-block-cover"><span aria-hidden="true" class="has-cyan-bluish-gray-background-color has-background-dim-100 wp-block-cover__gradient-background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
49
+ const COVER_BLOCK_SOLID_COLOR_HTML = `<!-- wp:cover {"overlayColor":"cyan-bluish-gray","isDark":false} -->
50
+ <div class="wp-block-cover is-light"><span aria-hidden="true" class="wp-block-cover__background has-cyan-bluish-gray-background-color has-background-dim-100 has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…"} -->
49
51
  <p class="has-text-align-center"></p>
50
52
  <!-- /wp:paragraph --></div></div>
51
53
  <!-- /wp:cover -->`;
54
+ const COVER_BLOCK_IMAGE_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","isDark":false} -->
55
+ <div class="wp-block-cover is-light"><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
56
+ <p class="has-text-align-center has-large-font-size"></p>
57
+ <!-- /wp:paragraph --></div></div>
58
+ <!-- /wp:cover -->`;
59
+ const COVER_BLOCK_CUSTOM_HEIGHT_HTML = `<!-- wp:cover {"url":"https://cldup.com/cXyG__fTLN.jpg","id":10710,"dimRatio":50,"overlayColor":"foreground","minHeight":20,"minHeightUnit":"vw","isDark":false} -->
60
+ <div class="wp-block-cover is-light" style="min-height:20vw"><span aria-hidden="true" class="wp-block-cover__background has-foreground-background-color has-background-dim"></span><img class="wp-block-cover__image-background wp-image-10710" alt="" src="https://cldup.com/cXyG__fTLN.jpg" data-object-fit="cover"/><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","placeholder":"Write title…","fontSize":"large"} -->
61
+ <p class="has-text-align-center has-large-font-size"></p>
62
+ <!-- /wp:paragraph --></div></div>
63
+ <!-- /wp:cover -->`;
52
64
 
53
65
  const COLOR_PINK = '#f78da7';
54
66
  const COLOR_RED = '#cf2e2e';
@@ -290,6 +302,34 @@ describe( 'when an image is attached', () => {
290
302
  } )
291
303
  );
292
304
  } );
305
+
306
+ it( 'updates background opacity', async () => {
307
+ const screen = await initializeEditor( {
308
+ initialHtml: COVER_BLOCK_IMAGE_HTML,
309
+ } );
310
+ const { getByA11yLabel } = screen;
311
+
312
+ // Get block
313
+ const coverBlock = await getBlock( screen, 'Cover' );
314
+ fireEvent.press( coverBlock );
315
+
316
+ // Open block settings
317
+ await openBlockSettings( screen );
318
+
319
+ // Update Opacity attribute
320
+ const opacityControl = getByA11yLabel( /Opacity/ );
321
+ fireEvent.press( within( opacityControl ).getByText( '50' ) );
322
+ const heightTextInput =
323
+ within( opacityControl ).getByDisplayValue( '50' );
324
+ fireEvent.changeText( heightTextInput, '20' );
325
+
326
+ // The decreasing button should be disabled
327
+ fireEvent( opacityControl, 'accessibilityAction', {
328
+ nativeEvent: { actionName: 'decrement' },
329
+ } );
330
+
331
+ expect( getEditorHtml() ).toMatchSnapshot();
332
+ } );
293
333
  } );
294
334
 
295
335
  describe( 'color settings', () => {
@@ -533,3 +573,95 @@ describe( 'color settings', () => {
533
573
  expect( getEditorHtml() ).toMatchSnapshot();
534
574
  } );
535
575
  } );
576
+
577
+ describe( 'minimum height settings', () => {
578
+ it( 'changes the height value to 20(vw)', async () => {
579
+ const screen = await initializeEditor( {
580
+ initialHtml: COVER_BLOCK_IMAGE_HTML,
581
+ } );
582
+ const { getByText, getByDisplayValue } = screen;
583
+
584
+ // Get block
585
+ const coverBlock = await getBlock( screen, 'Cover' );
586
+ fireEvent.press( coverBlock );
587
+
588
+ // Open block settings
589
+ await openBlockSettings( screen );
590
+
591
+ // Set vw unit
592
+ fireEvent.press( getByText( 'px' ) );
593
+ fireEvent.press( getByText( 'Viewport width (vw)' ) );
594
+
595
+ // Update height attribute
596
+ fireEvent.press( getByText( '300' ) );
597
+ const heightTextInput = getByDisplayValue( '300' );
598
+ fireEvent.changeText( heightTextInput, '20' );
599
+
600
+ expect( getEditorHtml() ).toMatchSnapshot();
601
+ } );
602
+
603
+ it( 'changes the height value between units', async () => {
604
+ const screen = await initializeEditor( {
605
+ initialHtml: COVER_BLOCK_CUSTOM_HEIGHT_HTML,
606
+ } );
607
+ const { getByText } = screen;
608
+
609
+ // Get block
610
+ const coverBlock = await getBlock( screen, 'Cover' );
611
+ fireEvent.press( coverBlock );
612
+
613
+ // Open block settings
614
+ await openBlockSettings( screen );
615
+
616
+ // Set the pixel unit
617
+ fireEvent.press( getByText( 'vw' ) );
618
+ fireEvent.press( getByText( 'Pixels (px)' ) );
619
+
620
+ expect( getEditorHtml() ).toMatchSnapshot();
621
+ } );
622
+
623
+ describe( 'disables the decrease button when reaching the minimum value', () => {
624
+ const testData = [
625
+ [ 'Pixels (px)', '50', '50' ],
626
+ [ 'Relative to parent font size (em)', '20', '1' ],
627
+ [ 'Relative to root font size (rem)', '20', '1' ],
628
+ [ 'Viewport width (vw)', '20', '1' ],
629
+ [ 'Viewport height (vh)', '20', '1' ],
630
+ ];
631
+
632
+ test.each( testData )(
633
+ 'for %s',
634
+ async ( unitName, value, minValue ) => {
635
+ const screen = await initializeEditor( {
636
+ initialHtml: COVER_BLOCK_CUSTOM_HEIGHT_HTML,
637
+ } );
638
+ const { getByA11yLabel, getByText } = screen;
639
+
640
+ // Get block
641
+ const coverBlock = await getBlock( screen, 'Cover' );
642
+ fireEvent.press( coverBlock );
643
+
644
+ // Open block settings
645
+ await openBlockSettings( screen );
646
+
647
+ // Set the unit name
648
+ fireEvent.press( getByText( 'vw' ) );
649
+ fireEvent.press( getByText( unitName ) );
650
+
651
+ // Update height attribute
652
+ const heightControl = getByA11yLabel( /Minimum height/ );
653
+ fireEvent.press( within( heightControl ).getByText( value ) );
654
+ const heightTextInput =
655
+ within( heightControl ).getByDisplayValue( value );
656
+ fireEvent.changeText( heightTextInput, minValue );
657
+
658
+ // The decreasing button should be disabled
659
+ fireEvent( heightControl, 'accessibilityAction', {
660
+ nativeEvent: { actionName: 'decrement' },
661
+ } );
662
+
663
+ expect( getEditorHtml() ).toMatchSnapshot();
664
+ }
665
+ );
666
+ } );
667
+ } );
@@ -8,18 +8,22 @@
8
8
  "textdomain": "default",
9
9
  "attributes": {
10
10
  "url": {
11
- "type": "string"
11
+ "type": "string",
12
+ "__experimentalRole": "content"
12
13
  },
13
14
  "caption": {
14
15
  "type": "string",
15
16
  "source": "html",
16
- "selector": "figcaption"
17
+ "selector": "figcaption",
18
+ "__experimentalRole": "content"
17
19
  },
18
20
  "type": {
19
- "type": "string"
21
+ "type": "string",
22
+ "__experimentalRole": "content"
20
23
  },
21
24
  "providerNameSlug": {
22
- "type": "string"
25
+ "type": "string",
26
+ "__experimentalRole": "content"
23
27
  },
24
28
  "allowResponsive": {
25
29
  "type": "boolean",
@@ -27,11 +31,13 @@
27
31
  },
28
32
  "responsive": {
29
33
  "type": "boolean",
30
- "default": false
34
+ "default": false,
35
+ "__experimentalRole": "content"
31
36
  },
32
37
  "previewable": {
33
38
  "type": "boolean",
34
- "default": true
39
+ "default": true,
40
+ "__experimentalRole": "content"
35
41
  }
36
42
  },
37
43
  "supports": {
@@ -39,8 +39,7 @@ jest.mock( 'react-native-modal', () => {
39
39
  } );
40
40
 
41
41
  // Mock debounce to prevent potentially belated state updates.
42
- jest.mock( 'lodash', () => ( {
43
- ...jest.requireActual( 'lodash' ),
42
+ jest.mock( '@wordpress/compose/src/utils/debounce', () => ( {
44
43
  debounce: ( fn ) => {
45
44
  fn.cancel = jest.fn();
46
45
  return fn;
@@ -32,7 +32,7 @@ import {
32
32
  /** @typedef {import('@wordpress/blocks').WPBlockVariation} WPBlockVariation */
33
33
 
34
34
  /**
35
- * Template option choices for predefined columns layouts.
35
+ * The embed provider services.
36
36
  *
37
37
  * @type {WPBlockVariation[]}
38
38
  */
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { debounce } from 'lodash';
5
-
6
1
  /**
7
2
  * WordPress dependencies
8
3
  */
@@ -11,6 +6,7 @@ import {
11
6
  useBlockProps,
12
7
  store as blockEditorStore,
13
8
  } from '@wordpress/block-editor';
9
+ import { debounce } from '@wordpress/compose';
14
10
  import { useSelect } from '@wordpress/data';
15
11
  import { ToolbarGroup } from '@wordpress/components';
16
12
  import { useEffect, useRef } from '@wordpress/element';
@@ -47,6 +43,10 @@ export default function ClassicEdit( {
47
43
  onReplace,
48
44
  } ) {
49
45
  const { getMultiSelectedBlockClientIds } = useSelect( blockEditorStore );
46
+ const canRemove = useSelect(
47
+ ( select ) => select( blockEditorStore ).canRemoveBlock( clientId ),
48
+ [ clientId ]
49
+ );
50
50
  const didMount = useRef( false );
51
51
 
52
52
  useEffect( () => {
@@ -225,11 +225,13 @@ export default function ClassicEdit( {
225
225
  /* eslint-disable jsx-a11y/no-static-element-interactions */
226
226
  return (
227
227
  <>
228
- <BlockControls>
229
- <ToolbarGroup>
230
- <ConvertToBlocksButton clientId={ clientId } />
231
- </ToolbarGroup>
232
- </BlockControls>
228
+ { canRemove && (
229
+ <BlockControls>
230
+ <ToolbarGroup>
231
+ <ConvertToBlocksButton clientId={ clientId } />
232
+ </ToolbarGroup>
233
+ </BlockControls>
234
+ ) }
233
235
  <div { ...useBlockProps() }>
234
236
  <div
235
237
  key="toolbar"
@@ -659,8 +659,8 @@ const v3 = {
659
659
  attribute: 'data-link',
660
660
  },
661
661
  caption: {
662
- type: 'array',
663
- source: 'children',
662
+ type: 'string',
663
+ source: 'html',
664
664
  selector: 'figcaption',
665
665
  },
666
666
  },
@@ -779,8 +779,8 @@ const v2 = {
779
779
  attribute: 'data-link',
780
780
  },
781
781
  caption: {
782
- type: 'array',
783
- source: 'children',
782
+ type: 'string',
783
+ source: 'html',
784
784
  selector: 'figcaption',
785
785
  },
786
786
  },
@@ -12,7 +12,6 @@ import {
12
12
  __experimentalGetElementClassName,
13
13
  } from '@wordpress/block-editor';
14
14
  import { VisuallyHidden } from '@wordpress/components';
15
- import { useState, useEffect } from '@wordpress/element';
16
15
  import { __ } from '@wordpress/i18n';
17
16
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
18
17
  import { View } from '@wordpress/primitives';
@@ -38,26 +37,6 @@ export const Gallery = ( props ) => {
38
37
  __experimentalLayout: { type: 'default', alignments: [] },
39
38
  } );
40
39
 
41
- const [ captionFocused, setCaptionFocused ] = useState( false );
42
-
43
- function onFocusCaption() {
44
- if ( ! captionFocused ) {
45
- setCaptionFocused( true );
46
- }
47
- }
48
-
49
- function removeCaptionFocus() {
50
- if ( captionFocused ) {
51
- setCaptionFocused( false );
52
- }
53
- }
54
-
55
- useEffect( () => {
56
- if ( ! isSelected ) {
57
- setCaptionFocused( false );
58
- }
59
- }, [ isSelected ] );
60
-
61
40
  return (
62
41
  <figure
63
42
  { ...innerBlocksProps }
@@ -74,17 +53,12 @@ export const Gallery = ( props ) => {
74
53
  >
75
54
  { children }
76
55
  { isSelected && ! children && (
77
- <View
78
- className="blocks-gallery-media-placeholder-wrapper"
79
- onClick={ removeCaptionFocus }
80
- >
56
+ <View className="blocks-gallery-media-placeholder-wrapper">
81
57
  { mediaPlaceholder }
82
58
  </View>
83
59
  ) }
84
60
  <RichTextVisibilityHelper
85
61
  isHidden={ ! isSelected && RichText.isEmpty( caption ) }
86
- captionFocused={ captionFocused }
87
- onFocusCaption={ onFocusCaption }
88
62
  tagName="figcaption"
89
63
  className={ classnames(
90
64
  'blocks-gallery-caption',
@@ -105,8 +79,6 @@ export const Gallery = ( props ) => {
105
79
 
106
80
  function RichTextVisibilityHelper( {
107
81
  isHidden,
108
- captionFocused,
109
- onFocusCaption,
110
82
  className,
111
83
  value,
112
84
  placeholder,
@@ -125,8 +97,6 @@ function RichTextVisibilityHelper( {
125
97
  placeholder={ placeholder }
126
98
  className={ className }
127
99
  tagName={ tagName }
128
- isSelected={ captionFocused }
129
- onClick={ onFocusCaption }
130
100
  { ...richTextProps }
131
101
  />
132
102
  );
@@ -0,0 +1,19 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`Group block inserts block and adds a Heading block as an inner block 1`] = `
4
+ "<!-- wp:group {\\"layout\\":{\\"type\\":\\"constrained\\"}} -->
5
+ <div class=\\"wp-block-group\\"><!-- wp:heading -->
6
+ <h2></h2>
7
+ <!-- /wp:heading --></div>
8
+ <!-- /wp:group -->"
9
+ `;
10
+
11
+ exports[`Group block ungroups inner blocks 1`] = `
12
+ "<!-- wp:image -->
13
+ <figure class=\\"wp-block-image\\"><img alt=\\"\\"/></figure>
14
+ <!-- /wp:image -->
15
+
16
+ <!-- wp:spacer -->
17
+ <div style=\\"height:100px\\" aria-hidden=\\"true\\" class=\\"wp-block-spacer\\"></div>
18
+ <!-- /wp:spacer -->"
19
+ `;