@wordpress/block-library 8.7.0 → 8.8.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 (270) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/column/index.js +2 -1
  3. package/build/column/index.js.map +1 -1
  4. package/build/columns/edit.js +24 -6
  5. package/build/columns/edit.js.map +1 -1
  6. package/build/columns/index.js +2 -1
  7. package/build/columns/index.js.map +1 -1
  8. package/build/columns/utils.js +4 -9
  9. package/build/columns/utils.js.map +1 -1
  10. package/build/cover/edit/index.js +46 -50
  11. package/build/cover/edit/index.js.map +1 -1
  12. package/build/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +32 -6
  13. package/build/cover/edit/resizable-cover-popover.js.map +1 -0
  14. package/build/cover/index.js +12 -0
  15. package/build/cover/index.js.map +1 -1
  16. package/build/details/edit.js +67 -0
  17. package/build/details/edit.js.map +1 -0
  18. package/build/details/index.js +110 -0
  19. package/build/details/index.js.map +1 -0
  20. package/build/details/save.js +33 -0
  21. package/build/details/save.js.map +1 -0
  22. package/build/details-content/edit.js +34 -0
  23. package/build/details-content/edit.js.map +1 -0
  24. package/build/details-content/index.js +94 -0
  25. package/build/details-content/index.js.map +1 -0
  26. package/build/details-content/save.js +20 -0
  27. package/build/details-content/save.js.map +1 -0
  28. package/build/details-summary/edit.js +42 -0
  29. package/build/details-summary/edit.js.map +1 -0
  30. package/build/details-summary/index.js +97 -0
  31. package/build/details-summary/index.js.map +1 -0
  32. package/build/details-summary/save.js +24 -0
  33. package/build/details-summary/save.js.map +1 -0
  34. package/build/embed/deprecated.js +4 -1
  35. package/build/embed/deprecated.js.map +1 -1
  36. package/build/embed/embed-link-settings.native.js +1 -1
  37. package/build/embed/embed-link-settings.native.js.map +1 -1
  38. package/build/embed/embed-placeholder.js +1 -1
  39. package/build/embed/embed-placeholder.js.map +1 -1
  40. package/build/embed/index.js +4 -1
  41. package/build/embed/index.js.map +1 -1
  42. package/build/embed/transforms.js +4 -1
  43. package/build/embed/transforms.js.map +1 -1
  44. package/build/embed/util.js +4 -1
  45. package/build/embed/util.js.map +1 -1
  46. package/build/file/edit.native.js +0 -2
  47. package/build/file/edit.native.js.map +1 -1
  48. package/build/gallery/use-get-media.native.js +2 -1
  49. package/build/gallery/use-get-media.native.js.map +1 -1
  50. package/build/image/index.js +4 -2
  51. package/build/image/index.js.map +1 -1
  52. package/build/index.js +24 -6
  53. package/build/index.js.map +1 -1
  54. package/build/media-text/media-container.js +2 -6
  55. package/build/media-text/media-container.js.map +1 -1
  56. package/build/media-text/media-container.native.js +3 -3
  57. package/build/media-text/media-container.native.js.map +1 -1
  58. package/build/navigation/deprecated.js +8 -11
  59. package/build/navigation/deprecated.js.map +1 -1
  60. package/build/navigation/edit/unsaved-inner-blocks.js +1 -14
  61. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  62. package/build/post-author/index.js +0 -1
  63. package/build/post-author/index.js.map +1 -1
  64. package/build/post-featured-image/dimension-controls.js +2 -1
  65. package/build/post-featured-image/dimension-controls.js.map +1 -1
  66. package/build/post-featured-image/edit.js +8 -22
  67. package/build/post-featured-image/edit.js.map +1 -1
  68. package/build/post-time-to-read/edit.js +1 -1
  69. package/build/post-time-to-read/edit.js.map +1 -1
  70. package/build/post-time-to-read/index.js +7 -0
  71. package/build/post-time-to-read/index.js.map +1 -1
  72. package/build/spacer/controls.js +25 -6
  73. package/build/spacer/controls.js.map +1 -1
  74. package/build/spacer/edit.js +14 -4
  75. package/build/spacer/edit.js.map +1 -1
  76. package/build/spacer/save.js +2 -2
  77. package/build/spacer/save.js.map +1 -1
  78. package/build/table/state.js +35 -35
  79. package/build/table/state.js.map +1 -1
  80. package/build/term-description/index.js +1 -2
  81. package/build/term-description/index.js.map +1 -1
  82. package/build/utils/clean-empty-object.js +5 -2
  83. package/build/utils/clean-empty-object.js.map +1 -1
  84. package/build-module/column/index.js +2 -1
  85. package/build-module/column/index.js.map +1 -1
  86. package/build-module/columns/edit.js +24 -6
  87. package/build-module/columns/edit.js.map +1 -1
  88. package/build-module/columns/index.js +2 -1
  89. package/build-module/columns/index.js.map +1 -1
  90. package/build-module/columns/utils.js +4 -8
  91. package/build-module/columns/utils.js.map +1 -1
  92. package/build-module/cover/edit/index.js +48 -52
  93. package/build-module/cover/edit/index.js.map +1 -1
  94. package/build-module/cover/edit/{resizable-cover.js → resizable-cover-popover.js} +31 -6
  95. package/build-module/cover/edit/resizable-cover-popover.js.map +1 -0
  96. package/build-module/cover/index.js +12 -0
  97. package/build-module/cover/index.js.map +1 -1
  98. package/build-module/details/edit.js +52 -0
  99. package/build-module/details/edit.js.map +1 -0
  100. package/build-module/details/index.js +91 -0
  101. package/build-module/details/index.js.map +1 -0
  102. package/build-module/details/save.js +20 -0
  103. package/build-module/details/save.js.map +1 -0
  104. package/build-module/details-content/edit.js +23 -0
  105. package/build-module/details-content/edit.js.map +1 -0
  106. package/build-module/details-content/index.js +76 -0
  107. package/build-module/details-content/index.js.map +1 -0
  108. package/build-module/details-content/save.js +11 -0
  109. package/build-module/details-content/save.js.map +1 -0
  110. package/build-module/details-summary/edit.js +30 -0
  111. package/build-module/details-summary/edit.js.map +1 -0
  112. package/build-module/details-summary/index.js +79 -0
  113. package/build-module/details-summary/index.js.map +1 -0
  114. package/build-module/details-summary/save.js +16 -0
  115. package/build-module/details-summary/save.js.map +1 -0
  116. package/build-module/embed/deprecated.js +4 -1
  117. package/build-module/embed/deprecated.js.map +1 -1
  118. package/build-module/embed/embed-link-settings.native.js +1 -1
  119. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  120. package/build-module/embed/embed-placeholder.js +1 -1
  121. package/build-module/embed/embed-placeholder.js.map +1 -1
  122. package/build-module/embed/index.js +4 -1
  123. package/build-module/embed/index.js.map +1 -1
  124. package/build-module/embed/transforms.js +4 -1
  125. package/build-module/embed/transforms.js.map +1 -1
  126. package/build-module/embed/util.js +4 -1
  127. package/build-module/embed/util.js.map +1 -1
  128. package/build-module/file/edit.native.js +0 -2
  129. package/build-module/file/edit.native.js.map +1 -1
  130. package/build-module/gallery/use-get-media.native.js +2 -1
  131. package/build-module/gallery/use-get-media.native.js.map +1 -1
  132. package/build-module/image/index.js +4 -2
  133. package/build-module/image/index.js.map +1 -1
  134. package/build-module/index.js +21 -6
  135. package/build-module/index.js.map +1 -1
  136. package/build-module/media-text/media-container.js +1 -5
  137. package/build-module/media-text/media-container.js.map +1 -1
  138. package/build-module/media-text/media-container.native.js +1 -1
  139. package/build-module/media-text/media-container.native.js.map +1 -1
  140. package/build-module/navigation/deprecated.js +8 -10
  141. package/build-module/navigation/deprecated.js.map +1 -1
  142. package/build-module/navigation/edit/unsaved-inner-blocks.js +1 -14
  143. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  144. package/build-module/post-author/index.js +0 -1
  145. package/build-module/post-author/index.js.map +1 -1
  146. package/build-module/post-featured-image/dimension-controls.js +2 -1
  147. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  148. package/build-module/post-featured-image/edit.js +8 -22
  149. package/build-module/post-featured-image/edit.js.map +1 -1
  150. package/build-module/post-time-to-read/edit.js +1 -1
  151. package/build-module/post-time-to-read/edit.js.map +1 -1
  152. package/build-module/post-time-to-read/index.js +7 -0
  153. package/build-module/post-time-to-read/index.js.map +1 -1
  154. package/build-module/spacer/controls.js +27 -9
  155. package/build-module/spacer/controls.js.map +1 -1
  156. package/build-module/spacer/edit.js +14 -5
  157. package/build-module/spacer/edit.js.map +1 -1
  158. package/build-module/spacer/save.js +3 -3
  159. package/build-module/spacer/save.js.map +1 -1
  160. package/build-module/table/state.js +35 -33
  161. package/build-module/table/state.js.map +1 -1
  162. package/build-module/term-description/index.js +1 -2
  163. package/build-module/term-description/index.js.map +1 -1
  164. package/build-module/utils/clean-empty-object.js +6 -3
  165. package/build-module/utils/clean-empty-object.js.map +1 -1
  166. package/build-style/columns/style-rtl.css +4 -1
  167. package/build-style/columns/style.css +4 -1
  168. package/build-style/common-rtl.css +1 -1
  169. package/build-style/common.css +1 -1
  170. package/build-style/cover/editor-rtl.css +11 -12
  171. package/build-style/cover/editor.css +11 -12
  172. package/build-style/cover/style-rtl.css +3 -2
  173. package/build-style/cover/style.css +3 -2
  174. package/build-style/details/style-rtl.css +91 -0
  175. package/build-style/details/style.css +91 -0
  176. package/build-style/details-summary/editor-rtl.css +91 -0
  177. package/build-style/details-summary/editor.css +91 -0
  178. package/build-style/details-summary/style-rtl.css +91 -0
  179. package/build-style/details-summary/style.css +91 -0
  180. package/build-style/editor-rtl.css +34 -48
  181. package/build-style/editor.css +34 -48
  182. package/build-style/file/style-rtl.css +4 -3
  183. package/build-style/file/style.css +4 -3
  184. package/build-style/post-excerpt/style-rtl.css +1 -1
  185. package/build-style/post-excerpt/style.css +1 -1
  186. package/build-style/pullquote/style-rtl.css +4 -1
  187. package/build-style/pullquote/style.css +4 -1
  188. package/build-style/shortcode/editor-rtl.css +15 -34
  189. package/build-style/shortcode/editor.css +15 -34
  190. package/build-style/spacer/editor-rtl.css +4 -2
  191. package/build-style/spacer/editor.css +4 -2
  192. package/build-style/style-rtl.css +25 -9
  193. package/build-style/style.css +25 -9
  194. package/package.json +31 -31
  195. package/src/column/block.json +2 -1
  196. package/src/columns/block.json +2 -1
  197. package/src/columns/edit.js +33 -9
  198. package/src/columns/style.scss +5 -1
  199. package/src/columns/utils.js +8 -9
  200. package/src/common.scss +1 -1
  201. package/src/cover/block.json +12 -0
  202. package/src/cover/edit/index.js +44 -37
  203. package/src/cover/edit/resizable-cover-popover.js +82 -0
  204. package/src/cover/editor.scss +20 -13
  205. package/src/cover/index.php +9 -10
  206. package/src/cover/style.scss +2 -1
  207. package/src/cover/test/edit.js +1 -1
  208. package/src/details/block.json +54 -0
  209. package/src/details/edit.js +59 -0
  210. package/src/details/index.js +35 -0
  211. package/src/details/save.js +15 -0
  212. package/src/details/style.scss +3 -0
  213. package/src/details-content/block.json +50 -0
  214. package/src/details-content/edit.js +29 -0
  215. package/src/details-content/index.js +23 -0
  216. package/src/details-content/save.js +12 -0
  217. package/src/details-summary/block.json +53 -0
  218. package/src/details-summary/edit.js +27 -0
  219. package/src/details-summary/editor.scss +3 -0
  220. package/src/details-summary/index.js +23 -0
  221. package/src/details-summary/save.js +13 -0
  222. package/src/details-summary/style.scss +3 -0
  223. package/src/editor.scss +1 -0
  224. package/src/embed/block.json +4 -1
  225. package/src/embed/embed-link-settings.native.js +1 -1
  226. package/src/embed/embed-placeholder.js +1 -1
  227. package/src/file/edit.native.js +0 -2
  228. package/src/file/style.scss +5 -2
  229. package/src/gallery/test/use-get-media.native.js +24 -0
  230. package/src/gallery/use-get-media.native.js +1 -1
  231. package/src/image/block.json +4 -2
  232. package/src/index.js +13 -3
  233. package/src/media-text/media-container.js +1 -5
  234. package/src/media-text/media-container.native.js +1 -1
  235. package/src/navigation/deprecated.js +15 -19
  236. package/src/navigation/edit/unsaved-inner-blocks.js +34 -46
  237. package/src/navigation/index.php +0 -4
  238. package/src/paragraph/test/edit.native.js +356 -1
  239. package/src/post-author/block.json +0 -1
  240. package/src/post-excerpt/index.php +3 -3
  241. package/src/post-excerpt/style.scss +2 -1
  242. package/src/post-featured-image/dimension-controls.js +5 -1
  243. package/src/post-featured-image/edit.js +8 -29
  244. package/src/post-time-to-read/block.json +7 -0
  245. package/src/post-time-to-read/edit.js +1 -1
  246. package/src/post-time-to-read/index.php +3 -3
  247. package/src/preformatted/test/__snapshots__/edit.native.js.snap +2 -2
  248. package/src/preformatted/test/edit.native.js +45 -2
  249. package/src/pullquote/style.scss +5 -1
  250. package/src/pullquote/test/edit.native.js +70 -0
  251. package/src/quote/test/edit.native.js +92 -0
  252. package/src/search/index.php +1 -1
  253. package/src/shortcode/editor.scss +26 -5
  254. package/src/spacer/controls.js +42 -17
  255. package/src/spacer/edit.js +23 -4
  256. package/src/spacer/editor.scss +2 -1
  257. package/src/spacer/save.js +3 -3
  258. package/src/style.scss +2 -0
  259. package/src/table/state.js +83 -66
  260. package/src/term-description/block.json +1 -2
  261. package/src/utils/clean-empty-object.js +4 -4
  262. package/src/verse/test/edit.native.js +33 -0
  263. package/build/cover/edit/resizable-cover.js.map +0 -1
  264. package/build/media-text/media-container-icon.js +0 -27
  265. package/build/media-text/media-container-icon.js.map +0 -1
  266. package/build-module/cover/edit/resizable-cover.js.map +0 -1
  267. package/build-module/media-text/media-container-icon.js +0 -17
  268. package/build-module/media-text/media-container-icon.js.map +0 -1
  269. package/src/cover/edit/resizable-cover.js +0 -61
  270. package/src/media-text/media-container-icon.js +0 -12
@@ -356,7 +356,6 @@
356
356
 
357
357
  .wp-block-columns {
358
358
  display: flex;
359
- margin-bottom: 1.75em;
360
359
  box-sizing: border-box;
361
360
  flex-wrap: wrap !important;
362
361
  align-items: initial !important;
@@ -403,6 +402,10 @@
403
402
  flex-grow: 0;
404
403
  }
405
404
 
405
+ :where(.wp-block-columns) {
406
+ margin-bottom: 1.75em;
407
+ }
408
+
406
409
  :where(.wp-block-columns.has-background) {
407
410
  padding: 1.25em 2.375em;
408
411
  }
@@ -611,6 +614,7 @@
611
614
  justify-content: center;
612
615
  align-items: center;
613
616
  padding: 1em;
617
+ overflow: hidden;
614
618
  box-sizing: border-box;
615
619
  /*rtl:raw: direction: ltr; */
616
620
  /**
@@ -827,7 +831,7 @@
827
831
  .wp-block-cover-image .wp-block-cover__inner-container,
828
832
  .wp-block-cover .wp-block-cover__inner-container {
829
833
  width: 100%;
830
- z-index: 1;
834
+ z-index: 32;
831
835
  color: inherit;
832
836
  /*rtl:raw: direction: rtl; */
833
837
  }
@@ -927,7 +931,7 @@ video.wp-block-cover__video-background.has-parallax {
927
931
  background-size: cover;
928
932
  background-repeat: no-repeat;
929
933
  }
930
- @supports (-webkit-overflow-scrolling: touch) {
934
+ @supports (-webkit-touch-callout: inherit) {
931
935
  .wp-block-cover-image.has-parallax,
932
936
  .wp-block-cover.has-parallax,
933
937
  .wp-block-cover__image-background.has-parallax,
@@ -1022,6 +1026,14 @@ section.wp-block-cover-image > h2,
1022
1026
  color: #000;
1023
1027
  }
1024
1028
 
1029
+ .wp-block-details {
1030
+ overflow: hidden;
1031
+ }
1032
+
1033
+ .wp-block-details-summary {
1034
+ cursor: pointer;
1035
+ }
1036
+
1025
1037
  .wp-block[data-align=left] > [data-type="core/embed"],
1026
1038
  .wp-block[data-align=right] > [data-type="core/embed"],
1027
1039
  .wp-block-embed.alignleft,
@@ -1093,9 +1105,6 @@ section.wp-block-cover-image > h2,
1093
1105
  padding-top: 200%;
1094
1106
  }
1095
1107
 
1096
- .wp-block-file {
1097
- margin-bottom: 1.5em;
1098
- }
1099
1108
  .wp-block-file:not(.wp-element-button) {
1100
1109
  font-size: 0.8em;
1101
1110
  }
@@ -1110,6 +1119,10 @@ section.wp-block-cover-image > h2,
1110
1119
  margin-left: 0.75em;
1111
1120
  }
1112
1121
 
1122
+ :where(.wp-block-file) {
1123
+ margin-bottom: 1.5em;
1124
+ }
1125
+
1113
1126
  .wp-block-file__embed {
1114
1127
  margin-bottom: 1em;
1115
1128
  }
@@ -2525,7 +2538,7 @@ p.has-background {
2525
2538
  box-sizing: border-box;
2526
2539
  }
2527
2540
 
2528
- .wp-block-post-excerpt {
2541
+ :where(.wp-block-post-excerpt) {
2529
2542
  margin-top: var(--wp--style--block-gap);
2530
2543
  margin-bottom: var(--wp--style--block-gap);
2531
2544
  }
@@ -2651,7 +2664,6 @@ p.has-background {
2651
2664
  }
2652
2665
 
2653
2666
  .wp-block-pullquote {
2654
- margin: 0 0 1em 0;
2655
2667
  padding: 3em 0;
2656
2668
  text-align: center;
2657
2669
  overflow-wrap: break-word;
@@ -2673,6 +2685,10 @@ p.has-background {
2673
2685
  color: inherit;
2674
2686
  }
2675
2687
 
2688
+ :where(.wp-block-pullquote) {
2689
+ margin: 0 0 1em 0;
2690
+ }
2691
+
2676
2692
  .wp-block-pullquote.has-text-align-left blockquote {
2677
2693
  text-align: left;
2678
2694
  }
@@ -3785,7 +3801,7 @@ html :where(img[class*="wp-image-"]) {
3785
3801
  /**
3786
3802
  * Reset user agent styles for figure element margins.
3787
3803
  */
3788
- figure {
3804
+ :where(figure) {
3789
3805
  margin: 0 0 1em 0;
3790
3806
  }
3791
3807
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.7.0",
3
+ "version": "8.8.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -31,35 +31,35 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.30.0",
35
- "@wordpress/api-fetch": "^6.27.0",
36
- "@wordpress/autop": "^3.30.0",
37
- "@wordpress/blob": "^3.30.0",
38
- "@wordpress/block-editor": "^11.7.0",
39
- "@wordpress/blocks": "^12.7.0",
40
- "@wordpress/components": "^23.7.0",
41
- "@wordpress/compose": "^6.7.0",
42
- "@wordpress/core-data": "^6.7.0",
43
- "@wordpress/data": "^9.0.0",
44
- "@wordpress/date": "^4.30.0",
45
- "@wordpress/deprecated": "^3.30.0",
46
- "@wordpress/dom": "^3.30.0",
47
- "@wordpress/element": "^5.7.0",
48
- "@wordpress/escape-html": "^2.30.0",
49
- "@wordpress/hooks": "^3.30.0",
50
- "@wordpress/html-entities": "^3.30.0",
51
- "@wordpress/i18n": "^4.30.0",
52
- "@wordpress/icons": "^9.21.0",
53
- "@wordpress/keycodes": "^3.30.0",
54
- "@wordpress/notices": "^3.30.0",
55
- "@wordpress/primitives": "^3.28.0",
56
- "@wordpress/private-apis": "^0.12.0",
57
- "@wordpress/reusable-blocks": "^4.7.0",
58
- "@wordpress/rich-text": "^6.7.0",
59
- "@wordpress/server-side-render": "^4.7.0",
60
- "@wordpress/url": "^3.31.0",
61
- "@wordpress/viewport": "^5.7.0",
62
- "@wordpress/wordcount": "^3.30.0",
34
+ "@wordpress/a11y": "^3.31.0",
35
+ "@wordpress/api-fetch": "^6.28.0",
36
+ "@wordpress/autop": "^3.31.0",
37
+ "@wordpress/blob": "^3.31.0",
38
+ "@wordpress/block-editor": "^11.8.0",
39
+ "@wordpress/blocks": "^12.8.0",
40
+ "@wordpress/components": "^23.8.0",
41
+ "@wordpress/compose": "^6.8.0",
42
+ "@wordpress/core-data": "^6.8.0",
43
+ "@wordpress/data": "^9.1.0",
44
+ "@wordpress/date": "^4.31.0",
45
+ "@wordpress/deprecated": "^3.31.0",
46
+ "@wordpress/dom": "^3.31.0",
47
+ "@wordpress/element": "^5.8.0",
48
+ "@wordpress/escape-html": "^2.31.0",
49
+ "@wordpress/hooks": "^3.31.0",
50
+ "@wordpress/html-entities": "^3.31.0",
51
+ "@wordpress/i18n": "^4.31.0",
52
+ "@wordpress/icons": "^9.22.0",
53
+ "@wordpress/keycodes": "^3.31.0",
54
+ "@wordpress/notices": "^3.31.0",
55
+ "@wordpress/primitives": "^3.29.0",
56
+ "@wordpress/private-apis": "^0.13.0",
57
+ "@wordpress/reusable-blocks": "^4.8.0",
58
+ "@wordpress/rich-text": "^6.8.0",
59
+ "@wordpress/server-side-render": "^4.8.0",
60
+ "@wordpress/url": "^3.32.0",
61
+ "@wordpress/viewport": "^5.8.0",
62
+ "@wordpress/wordcount": "^3.31.0",
63
63
  "change-case": "^4.1.2",
64
64
  "classnames": "^2.3.1",
65
65
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "d5c28a67b11e91e3e4b8e90346bfcb90909364d6"
81
+ "gitHead": "d61700b9f1c72ba0b030fc815ef1685b4f4031ec"
82
82
  }
@@ -38,7 +38,8 @@
38
38
  "blockGap": true,
39
39
  "padding": true,
40
40
  "__experimentalDefaultControls": {
41
- "padding": true
41
+ "padding": true,
42
+ "blockGap": true
42
43
  }
43
44
  },
44
45
  "__experimentalBorder": {
@@ -39,7 +39,8 @@
39
39
  "margin": [ "top", "bottom" ],
40
40
  "padding": true,
41
41
  "__experimentalDefaultControls": {
42
- "padding": true
42
+ "padding": true,
43
+ "blockGap": true
43
44
  }
44
45
  },
45
46
  "__experimentalLayout": {
@@ -60,13 +60,35 @@ function ColumnsEditContainer( {
60
60
  } ) {
61
61
  const { isStackedOnMobile, verticalAlignment, templateLock } = attributes;
62
62
 
63
- const { count, canInsertColumnBlock } = useSelect(
63
+ const { count, canInsertColumnBlock, minCount } = useSelect(
64
64
  ( select ) => {
65
+ const {
66
+ canInsertBlockType,
67
+ canRemoveBlock,
68
+ getBlocks,
69
+ getBlockCount,
70
+ } = select( blockEditorStore );
71
+ const innerBlocks = getBlocks( clientId );
72
+
73
+ // Get the indexes of columns for which removal is prevented.
74
+ // The highest index will be used to determine the minimum column count.
75
+ const preventRemovalBlockIndexes = innerBlocks.reduce(
76
+ ( acc, block, index ) => {
77
+ if ( ! canRemoveBlock( block.clientId ) ) {
78
+ acc.push( index );
79
+ }
80
+ return acc;
81
+ },
82
+ []
83
+ );
84
+
65
85
  return {
66
- count: select( blockEditorStore ).getBlockCount( clientId ),
67
- canInsertColumnBlock: select(
68
- blockEditorStore
69
- ).canInsertBlockType( 'core/column', clientId ),
86
+ count: getBlockCount( clientId ),
87
+ canInsertColumnBlock: canInsertBlockType(
88
+ 'core/column',
89
+ clientId
90
+ ),
91
+ minCount: Math.max( ...preventRemovalBlockIndexes ) + 1,
70
92
  };
71
93
  },
72
94
  [ clientId ]
@@ -104,9 +126,12 @@ function ColumnsEditContainer( {
104
126
  label={ __( 'Columns' ) }
105
127
  value={ count }
106
128
  onChange={ ( value ) =>
107
- updateColumns( count, value )
129
+ updateColumns(
130
+ count,
131
+ Math.max( minCount, value )
132
+ )
108
133
  }
109
- min={ 1 }
134
+ min={ Math.max( 1, minCount ) }
110
135
  max={ Math.max( 6, count ) }
111
136
  />
112
137
  { count > 6 && (
@@ -214,13 +239,12 @@ const ColumnsEditContainerWrapper = withDispatch(
214
239
  return createBlock( 'core/column' );
215
240
  } ),
216
241
  ];
217
- } else {
242
+ } else if ( newColumns < previousColumns ) {
218
243
  // The removed column will be the last of the inner blocks.
219
244
  innerBlocks = innerBlocks.slice(
220
245
  0,
221
246
  -( previousColumns - newColumns )
222
247
  );
223
-
224
248
  if ( hasExplicitWidths ) {
225
249
  // Redistribute as if block is already removed.
226
250
  const widths = getRedistributedColumnWidths(
@@ -1,6 +1,5 @@
1
1
  .wp-block-columns {
2
2
  display: flex;
3
- margin-bottom: 1.75em;
4
3
  box-sizing: border-box;
5
4
 
6
5
  // Responsiveness: Allow wrapping on mobile.
@@ -73,6 +72,11 @@
73
72
  }
74
73
  }
75
74
 
75
+ // Lower specificity of margin styles so they don't override the Layout block support.
76
+ :where(.wp-block-columns) {
77
+ margin-bottom: 1.75em;
78
+ }
79
+
76
80
  // Add low specificity default padding to columns blocks with backgrounds.
77
81
  :where(.wp-block-columns.has-background) {
78
82
  // Matches paragraph block padding.
@@ -1,8 +1,3 @@
1
- /**
2
- * External dependencies
3
- */
4
- import { mapValues } from 'lodash';
5
-
6
1
  /**
7
2
  * Returns a column width attribute value rounded to standard precision.
8
3
  * Returns `undefined` if the value is not a valid finite number.
@@ -86,10 +81,14 @@ export function getRedistributedColumnWidths(
86
81
  ) {
87
82
  const totalWidth = getTotalColumnsWidth( blocks, totalBlockCount );
88
83
 
89
- return mapValues( getColumnWidths( blocks, totalBlockCount ), ( width ) => {
90
- const newWidth = ( availableWidth * width ) / totalWidth;
91
- return toWidthPrecision( newWidth );
92
- } );
84
+ return Object.fromEntries(
85
+ Object.entries( getColumnWidths( blocks, totalBlockCount ) ).map(
86
+ ( [ clientId, width ] ) => {
87
+ const newWidth = ( availableWidth * width ) / totalWidth;
88
+ return [ clientId, toWidthPrecision( newWidth ) ];
89
+ }
90
+ )
91
+ );
93
92
  }
94
93
 
95
94
  /**
package/src/common.scss CHANGED
@@ -158,7 +158,7 @@ html :where(img[class*="wp-image-"]) {
158
158
  /**
159
159
  * Reset user agent styles for figure element margins.
160
160
  */
161
- figure {
161
+ :where(figure) {
162
162
  margin: 0 0 1em 0;
163
163
  }
164
164
 
@@ -94,6 +94,18 @@
94
94
  "blockGap": true
95
95
  }
96
96
  },
97
+ "__experimentalBorder": {
98
+ "color": true,
99
+ "radius": true,
100
+ "style": true,
101
+ "width": true,
102
+ "__experimentalDefaultControls": {
103
+ "color": true,
104
+ "radius": true,
105
+ "style": true,
106
+ "width": true
107
+ }
108
+ },
97
109
  "color": {
98
110
  "__experimentalDuotone": "> .wp-block-cover__image-background, > .wp-block-cover__video-background",
99
111
  "text": true,
@@ -9,9 +9,9 @@ import namesPlugin from 'colord/plugins/names';
9
9
  * WordPress dependencies
10
10
  */
11
11
  import { useEntityProp, store as coreStore } from '@wordpress/core-data';
12
- import { useEffect, useRef } from '@wordpress/element';
12
+ import { useEffect, useMemo, useRef } from '@wordpress/element';
13
13
  import { Placeholder, Spinner } from '@wordpress/components';
14
- import { compose } from '@wordpress/compose';
14
+ import { compose, useResizeObserver } from '@wordpress/compose';
15
15
  import {
16
16
  withColors,
17
17
  ColorPalette,
@@ -42,7 +42,7 @@ import useCoverIsDark from './use-cover-is-dark';
42
42
  import CoverInspectorControls from './inspector-controls';
43
43
  import CoverBlockControls from './block-controls';
44
44
  import CoverPlaceholder from './cover-placeholder';
45
- import ResizableCover from './resizable-cover';
45
+ import ResizableCoverPopover from './resizable-cover-popover';
46
46
 
47
47
  extend( [ namesPlugin ] );
48
48
 
@@ -146,6 +146,14 @@ function CoverEdit( {
146
146
  const isImageBackground = IMAGE_BACKGROUND_TYPE === backgroundType;
147
147
  const isVideoBackground = VIDEO_BACKGROUND_TYPE === backgroundType;
148
148
 
149
+ const [ resizeListener, { height, width } ] = useResizeObserver();
150
+ const resizableBoxDimensions = useMemo( () => {
151
+ return {
152
+ height: minHeightUnit === 'px' ? minHeight : 'auto',
153
+ width: 'auto',
154
+ };
155
+ }, [ minHeight, minHeightUnit ] );
156
+
149
157
  const minHeightWithUnit =
150
158
  minHeight && minHeightUnit
151
159
  ? `${ minHeight }${ minHeightUnit }`
@@ -246,24 +254,50 @@ function CoverEdit( {
246
254
  />
247
255
  );
248
256
 
257
+ const resizableCoverProps = {
258
+ className: 'block-library-cover__resize-container',
259
+ clientId,
260
+ height,
261
+ minHeight: minHeightWithUnit,
262
+ onResizeStart: () => {
263
+ setAttributes( { minHeightUnit: 'px' } );
264
+ toggleSelection( false );
265
+ },
266
+ onResize: ( value ) => {
267
+ setAttributes( { minHeight: value } );
268
+ },
269
+ onResizeStop: ( newMinHeight ) => {
270
+ toggleSelection( true );
271
+ setAttributes( { minHeight: newMinHeight } );
272
+ },
273
+ showHandle: true,
274
+ size: resizableBoxDimensions,
275
+ width,
276
+ };
277
+
249
278
  if ( ! useFeaturedImage && ! hasInnerBlocks && ! hasBackground ) {
250
279
  return (
251
280
  <>
252
281
  { blockControls }
253
282
  { inspectorControls }
283
+ { isSelected && (
284
+ <ResizableCoverPopover { ...resizableCoverProps } />
285
+ ) }
254
286
  <TagName
255
287
  { ...blockProps }
256
288
  className={ classnames(
257
289
  'is-placeholder',
258
290
  blockProps.className
259
291
  ) }
292
+ style={ {
293
+ ...blockProps.style,
294
+ minHeight: minHeightWithUnit || undefined,
295
+ } }
260
296
  >
297
+ { resizeListener }
261
298
  <CoverPlaceholder
262
299
  onSelectMedia={ onSelectMedia }
263
300
  onError={ onUploadError }
264
- style={ {
265
- minHeight: minHeightWithUnit || undefined,
266
- } }
267
301
  toggleUseFeaturedImage={ toggleUseFeaturedImage }
268
302
  >
269
303
  <div className="wp-block-cover__placeholder-background-options">
@@ -275,21 +309,6 @@ function CoverEdit( {
275
309
  />
276
310
  </div>
277
311
  </CoverPlaceholder>
278
- <ResizableCover
279
- className="block-library-cover__resize-container"
280
- onResizeStart={ () => {
281
- setAttributes( { minHeightUnit: 'px' } );
282
- toggleSelection( false );
283
- } }
284
- onResize={ ( value ) => {
285
- setAttributes( { minHeight: value } );
286
- } }
287
- onResizeStop={ ( newMinHeight ) => {
288
- toggleSelection( true );
289
- setAttributes( { minHeight: newMinHeight } );
290
- } }
291
- showHandle={ isSelected }
292
- />
293
312
  </TagName>
294
313
  </>
295
314
  );
@@ -318,22 +337,7 @@ function CoverEdit( {
318
337
  style={ { ...style, ...blockProps.style } }
319
338
  data-url={ url }
320
339
  >
321
- <ResizableCover
322
- className="block-library-cover__resize-container"
323
- onResizeStart={ () => {
324
- setAttributes( { minHeightUnit: 'px' } );
325
- toggleSelection( false );
326
- } }
327
- onResize={ ( value ) => {
328
- setAttributes( { minHeight: value } );
329
- } }
330
- onResizeStop={ ( newMinHeight ) => {
331
- toggleSelection( true );
332
- setAttributes( { minHeight: newMinHeight } );
333
- } }
334
- showHandle={ isSelected }
335
- />
336
-
340
+ { resizeListener }
337
341
  { ( ! useFeaturedImage || url ) && (
338
342
  <span
339
343
  aria-hidden="true"
@@ -404,6 +408,9 @@ function CoverEdit( {
404
408
  />
405
409
  <div { ...innerBlocksProps } />
406
410
  </TagName>
411
+ { isSelected && (
412
+ <ResizableCoverPopover { ...resizableCoverProps } />
413
+ ) }
407
414
  </>
408
415
  );
409
416
  }
@@ -0,0 +1,82 @@
1
+ /**
2
+ * External dependencies
3
+ */
4
+ import classnames from 'classnames';
5
+
6
+ /**
7
+ * WordPress dependencies
8
+ */
9
+ import { useMemo, useState } from '@wordpress/element';
10
+ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor';
11
+
12
+ /**
13
+ * Internal dependencies
14
+ */
15
+ import { unlock } from '../../private-apis';
16
+
17
+ const RESIZABLE_BOX_ENABLE_OPTION = {
18
+ top: false,
19
+ right: false,
20
+ bottom: true,
21
+ left: false,
22
+ topRight: false,
23
+ bottomRight: false,
24
+ bottomLeft: false,
25
+ topLeft: false,
26
+ };
27
+
28
+ export default function ResizableCoverPopover( {
29
+ className,
30
+ height,
31
+ minHeight,
32
+ onResize,
33
+ onResizeStart,
34
+ onResizeStop,
35
+ showHandle,
36
+ size,
37
+ width,
38
+ ...props
39
+ } ) {
40
+ const { ResizableBoxPopover } = unlock( blockEditorPrivateApis );
41
+ const [ isResizing, setIsResizing ] = useState( false );
42
+ const dimensions = useMemo(
43
+ () => ( { height, minHeight, width } ),
44
+ [ minHeight, height, width ]
45
+ );
46
+
47
+ const resizableBoxProps = {
48
+ className: classnames( className, { 'is-resizing': isResizing } ),
49
+ enable: RESIZABLE_BOX_ENABLE_OPTION,
50
+ onResizeStart: ( _event, _direction, elt ) => {
51
+ onResizeStart( elt.clientHeight );
52
+ onResize( elt.clientHeight );
53
+ },
54
+ onResize: ( _event, _direction, elt ) => {
55
+ onResize( elt.clientHeight );
56
+ if ( ! isResizing ) {
57
+ setIsResizing( true );
58
+ }
59
+ },
60
+ onResizeStop: ( _event, _direction, elt ) => {
61
+ onResizeStop( elt.clientHeight );
62
+ setIsResizing( false );
63
+ },
64
+ showHandle,
65
+ size,
66
+ __experimentalShowTooltip: true,
67
+ __experimentalTooltipProps: {
68
+ axis: 'y',
69
+ position: 'bottom',
70
+ isVisible: isResizing,
71
+ },
72
+ };
73
+
74
+ return (
75
+ <ResizableBoxPopover
76
+ className="block-library-cover__resizable-box-popover"
77
+ __unstableRefreshSize={ dimensions }
78
+ resizableBoxProps={ resizableBoxProps }
79
+ { ...props }
80
+ />
81
+ );
82
+ }
@@ -7,24 +7,23 @@
7
7
  // Override default cover styles
8
8
  // because we're not ready yet to show the cover block.
9
9
  &.is-placeholder {
10
- min-height: auto !important;
11
10
  padding: 0 !important;
11
+ display: flex;
12
+ align-items: stretch;
13
+ overflow: visible;
14
+ min-height: 240px;
12
15
 
13
- // Resizable placeholder for placeholder.
14
- .block-library-cover__resize-container {
15
- display: none;
16
- }
17
16
  .components-placeholder {
18
17
  &.is-large {
19
- min-height: 240px;
20
18
  justify-content: flex-start;
21
19
  z-index: z-index(".wp-block-cover.is-placeholder .components-placeholder.is-large");
22
- + .block-library-cover__resize-container {
23
- min-height: 240px;
24
- display: block;
25
- }
26
20
  }
27
21
  }
22
+
23
+ // Allow focus outline/box-shadow to align with block's min height.
24
+ &:focus::after {
25
+ min-height: auto;
26
+ }
28
27
  }
29
28
 
30
29
  &.components-placeholder h2 {
@@ -88,9 +87,17 @@
88
87
  min-height: 50px;
89
88
  }
90
89
 
91
- .block-library-cover__resize-container:not(.is-resizing) {
92
- // Important is used to have higher specificity than the inline style set by re-resizable library.
93
- height: auto !important;
90
+ // Prevent resizable box popover form preventing inner block selection.
91
+ .components-popover.block-editor-block-popover.block-library-cover__resizable-box-popover {
92
+ // Additional specificity is required to overcome default block popover
93
+ // pointer events only for the intended wrappers. The default pointer events
94
+ // are still needed for the inner resize handles of the resizable box.
95
+ .components-popover__content > div,
96
+ .block-library-cover__resize-container {
97
+ // The inner drag handle will still have `pointer-events: all` allowing
98
+ // it to continue to be interacted with.
99
+ pointer-events: none;
100
+ }
94
101
  }
95
102
 
96
103
  // When uploading background images, show a transparent overlay.
@@ -34,7 +34,7 @@ function render_block_core_cover( $attributes, $content ) {
34
34
 
35
35
  /*
36
36
  * Inserts the featured image between the (1st) cover 'background' `span` and 'inner_container' `div`,
37
- * and removes eventual withespace characters between the two (typically introduced at template level)
37
+ * and removes eventual whitespace characters between the two (typically introduced at template level)
38
38
  */
39
39
  $inner_container_start = '/<div\b[^>]+wp-block-cover__inner-container[\s|"][^>]*>/U';
40
40
  if ( 1 === preg_match( $inner_container_start, $content, $matches, PREG_OFFSET_CAPTURE ) ) {
@@ -46,19 +46,18 @@ function render_block_core_cover( $attributes, $content ) {
46
46
  update_post_thumbnail_cache();
47
47
  }
48
48
  $current_featured_image = get_the_post_thumbnail_url();
49
-
50
- $styles = 'background-image:url(' . esc_url( $current_featured_image ) . '); ';
51
-
52
- if ( isset( $attributes['minHeight'] ) ) {
53
- $height_unit = empty( $attributes['minHeightUnit'] ) ? 'px' : $attributes['minHeightUnit'];
54
- $height = " min-height:{$attributes['minHeight']}{$height_unit}";
55
-
56
- $styles .= $height;
49
+ if ( ! $current_featured_image ) {
50
+ return $content;
57
51
  }
58
52
 
59
53
  $processor = new WP_HTML_Tag_Processor( $content );
60
54
  $processor->next_tag();
61
- $processor->set_attribute( 'style', $styles );
55
+
56
+ $styles = $processor->get_attribute( 'style' );
57
+ $merged_styles = ! empty( $styles ) ? $styles . ';' : '';
58
+ $merged_styles .= 'background-image:url(' . esc_url( $current_featured_image ) . ');';
59
+
60
+ $processor->set_attribute( 'style', $merged_styles );
62
61
  $content = $processor->get_updated_html();
63
62
  }
64
63