@wordpress/block-library 8.22.0 → 8.24.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 (266) hide show
  1. package/CHANGELOG.md +4 -0
  2. package/build/block/edit.js +11 -13
  3. package/build/block/edit.js.map +1 -1
  4. package/build/block/edit.native.js +3 -4
  5. package/build/block/edit.native.js.map +1 -1
  6. package/build/button/edit.js +61 -9
  7. package/build/button/edit.js.map +1 -1
  8. package/build/code/transforms.js +20 -7
  9. package/build/code/transforms.js.map +1 -1
  10. package/build/column/edit.js +1 -1
  11. package/build/column/edit.js.map +1 -1
  12. package/build/column/edit.native.js +1 -1
  13. package/build/column/edit.native.js.map +1 -1
  14. package/build/comments/edit/comments-inspector-controls.js +1 -0
  15. package/build/comments/edit/comments-inspector-controls.js.map +1 -1
  16. package/build/cover/edit/index.js +2 -1
  17. package/build/cover/edit/index.js.map +1 -1
  18. package/build/cover/edit/inspector-controls.js +1 -0
  19. package/build/cover/edit/inspector-controls.js.map +1 -1
  20. package/build/details/edit.js +1 -2
  21. package/build/details/edit.js.map +1 -1
  22. package/build/file/edit.js +8 -9
  23. package/build/file/edit.js.map +1 -1
  24. package/build/file/view.js +4 -6
  25. package/build/file/view.js.map +1 -1
  26. package/build/form/index.js +1 -1
  27. package/build/form/index.js.map +1 -1
  28. package/build/form-submit-button/edit.js +2 -1
  29. package/build/form-submit-button/edit.js.map +1 -1
  30. package/build/gallery/gap-styles.js +12 -7
  31. package/build/gallery/gap-styles.js.map +1 -1
  32. package/build/group/edit.js +4 -7
  33. package/build/group/edit.js.map +1 -1
  34. package/build/html/transforms.js +7 -2
  35. package/build/html/transforms.js.map +1 -1
  36. package/build/image/deprecated.js +8 -0
  37. package/build/image/deprecated.js.map +1 -1
  38. package/build/image/edit.js +17 -18
  39. package/build/image/edit.js.map +1 -1
  40. package/build/image/edit.native.js +22 -15
  41. package/build/image/edit.native.js.map +1 -1
  42. package/build/image/image.js +35 -27
  43. package/build/image/image.js.map +1 -1
  44. package/build/image/index.js +2 -3
  45. package/build/image/index.js.map +1 -1
  46. package/build/image/view.js +234 -266
  47. package/build/image/view.js.map +1 -1
  48. package/build/missing/index.js +1 -1
  49. package/build/navigation/edit/overlay-menu-preview.js +1 -1
  50. package/build/navigation/edit/overlay-menu-preview.js.map +1 -1
  51. package/build/navigation/use-template-part-area-label.js +2 -1
  52. package/build/navigation/use-template-part-area-label.js.map +1 -1
  53. package/build/navigation/view.js +153 -176
  54. package/build/navigation/view.js.map +1 -1
  55. package/build/navigation-link/edit.js +1 -1
  56. package/build/navigation-link/edit.js.map +1 -1
  57. package/build/navigation-link/index.js +2 -1
  58. package/build/navigation-link/index.js.map +1 -1
  59. package/build/pattern/edit.js +2 -4
  60. package/build/pattern/edit.js.map +1 -1
  61. package/build/post-author/edit.js +0 -1
  62. package/build/post-author/edit.js.map +1 -1
  63. package/build/post-featured-image/edit.js +21 -6
  64. package/build/post-featured-image/edit.js.map +1 -1
  65. package/build/post-template/edit.js +2 -8
  66. package/build/post-template/edit.js.map +1 -1
  67. package/build/post-template/index.js +1 -1
  68. package/build/post-terms/edit.js +0 -2
  69. package/build/post-terms/edit.js.map +1 -1
  70. package/build/preformatted/transforms.js +1 -4
  71. package/build/preformatted/transforms.js.map +1 -1
  72. package/build/query/edit/query-content.js +1 -0
  73. package/build/query/edit/query-content.js.map +1 -1
  74. package/build/query/view.js +52 -60
  75. package/build/query/view.js.map +1 -1
  76. package/build/quote/index.js +6 -0
  77. package/build/quote/index.js.map +1 -1
  78. package/build/search/view.js +66 -74
  79. package/build/search/view.js.map +1 -1
  80. package/build/template-part/edit/advanced-controls.js +1 -0
  81. package/build/template-part/edit/advanced-controls.js.map +1 -1
  82. package/build/template-part/edit/index.js +3 -7
  83. package/build/template-part/edit/index.js.map +1 -1
  84. package/build/template-part/index.js +6 -2
  85. package/build/template-part/index.js.map +1 -1
  86. package/build/template-part/variations.js +5 -1
  87. package/build/template-part/variations.js.map +1 -1
  88. package/build/utils/remove-anchor-tag.js +17 -0
  89. package/build/utils/remove-anchor-tag.js.map +1 -0
  90. package/build-module/block/edit.js +11 -13
  91. package/build-module/block/edit.js.map +1 -1
  92. package/build-module/block/edit.native.js +3 -4
  93. package/build-module/block/edit.native.js.map +1 -1
  94. package/build-module/button/edit.js +65 -13
  95. package/build-module/button/edit.js.map +1 -1
  96. package/build-module/code/transforms.js +20 -7
  97. package/build-module/code/transforms.js.map +1 -1
  98. package/build-module/column/edit.js +1 -1
  99. package/build-module/column/edit.js.map +1 -1
  100. package/build-module/column/edit.native.js +1 -1
  101. package/build-module/column/edit.native.js.map +1 -1
  102. package/build-module/comments/edit/comments-inspector-controls.js +1 -0
  103. package/build-module/comments/edit/comments-inspector-controls.js.map +1 -1
  104. package/build-module/cover/edit/index.js +2 -1
  105. package/build-module/cover/edit/index.js.map +1 -1
  106. package/build-module/cover/edit/inspector-controls.js +1 -0
  107. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  108. package/build-module/details/edit.js +1 -2
  109. package/build-module/details/edit.js.map +1 -1
  110. package/build-module/file/edit.js +8 -9
  111. package/build-module/file/edit.js.map +1 -1
  112. package/build-module/file/view.js +5 -7
  113. package/build-module/file/view.js.map +1 -1
  114. package/build-module/form/index.js +1 -1
  115. package/build-module/form/index.js.map +1 -1
  116. package/build-module/form-submit-button/edit.js +2 -1
  117. package/build-module/form-submit-button/edit.js.map +1 -1
  118. package/build-module/gallery/gap-styles.js +13 -8
  119. package/build-module/gallery/gap-styles.js.map +1 -1
  120. package/build-module/group/edit.js +4 -7
  121. package/build-module/group/edit.js.map +1 -1
  122. package/build-module/html/transforms.js +7 -2
  123. package/build-module/html/transforms.js.map +1 -1
  124. package/build-module/image/deprecated.js +8 -0
  125. package/build-module/image/deprecated.js.map +1 -1
  126. package/build-module/image/edit.js +18 -19
  127. package/build-module/image/edit.js.map +1 -1
  128. package/build-module/image/edit.native.js +23 -16
  129. package/build-module/image/edit.native.js.map +1 -1
  130. package/build-module/image/image.js +36 -28
  131. package/build-module/image/image.js.map +1 -1
  132. package/build-module/image/index.js +2 -3
  133. package/build-module/image/index.js.map +1 -1
  134. package/build-module/image/view.js +235 -267
  135. package/build-module/image/view.js.map +1 -1
  136. package/build-module/missing/index.js +1 -1
  137. package/build-module/navigation/edit/overlay-menu-preview.js +1 -1
  138. package/build-module/navigation/edit/overlay-menu-preview.js.map +1 -1
  139. package/build-module/navigation/use-template-part-area-label.js +2 -1
  140. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  141. package/build-module/navigation/view.js +154 -177
  142. package/build-module/navigation/view.js.map +1 -1
  143. package/build-module/navigation-link/edit.js +2 -2
  144. package/build-module/navigation-link/edit.js.map +1 -1
  145. package/build-module/navigation-link/index.js +2 -1
  146. package/build-module/navigation-link/index.js.map +1 -1
  147. package/build-module/pattern/edit.js +2 -4
  148. package/build-module/pattern/edit.js.map +1 -1
  149. package/build-module/post-author/edit.js +0 -1
  150. package/build-module/post-author/edit.js.map +1 -1
  151. package/build-module/post-featured-image/edit.js +21 -6
  152. package/build-module/post-featured-image/edit.js.map +1 -1
  153. package/build-module/post-template/edit.js +2 -8
  154. package/build-module/post-template/edit.js.map +1 -1
  155. package/build-module/post-template/index.js +1 -1
  156. package/build-module/post-terms/edit.js +0 -2
  157. package/build-module/post-terms/edit.js.map +1 -1
  158. package/build-module/preformatted/transforms.js +1 -4
  159. package/build-module/preformatted/transforms.js.map +1 -1
  160. package/build-module/query/edit/query-content.js +1 -0
  161. package/build-module/query/edit/query-content.js.map +1 -1
  162. package/build-module/query/view.js +53 -61
  163. package/build-module/query/view.js.map +1 -1
  164. package/build-module/quote/index.js +6 -0
  165. package/build-module/quote/index.js.map +1 -1
  166. package/build-module/search/view.js +67 -75
  167. package/build-module/search/view.js.map +1 -1
  168. package/build-module/template-part/edit/advanced-controls.js +1 -0
  169. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  170. package/build-module/template-part/edit/index.js +5 -9
  171. package/build-module/template-part/edit/index.js.map +1 -1
  172. package/build-module/template-part/index.js +6 -2
  173. package/build-module/template-part/index.js.map +1 -1
  174. package/build-module/template-part/variations.js +5 -1
  175. package/build-module/template-part/variations.js.map +1 -1
  176. package/build-module/utils/remove-anchor-tag.js +11 -0
  177. package/build-module/utils/remove-anchor-tag.js.map +1 -0
  178. package/build-style/cover/style-rtl.css +14 -14
  179. package/build-style/cover/style.css +14 -14
  180. package/build-style/editor-rtl.css +15 -6
  181. package/build-style/editor.css +15 -6
  182. package/build-style/gallery/style-rtl.css +28 -0
  183. package/build-style/gallery/style.css +28 -0
  184. package/build-style/image/style-rtl.css +19 -13
  185. package/build-style/image/style.css +19 -13
  186. package/build-style/post-featured-image/editor-rtl.css +9 -0
  187. package/build-style/post-featured-image/editor.css +9 -0
  188. package/build-style/quote/style-rtl.css +3 -0
  189. package/build-style/quote/style.css +3 -0
  190. package/build-style/read-more/style-rtl.css +2 -2
  191. package/build-style/read-more/style.css +2 -2
  192. package/build-style/style-rtl.css +66 -29
  193. package/build-style/style.css +66 -29
  194. package/package.json +32 -32
  195. package/src/block/edit.js +20 -20
  196. package/src/block/edit.native.js +5 -13
  197. package/src/button/edit.js +76 -10
  198. package/src/buttons/test/__snapshots__/edit.native.js.snap +0 -6
  199. package/src/buttons/test/edit.native.js +0 -27
  200. package/src/code/transforms.js +14 -8
  201. package/src/column/edit.js +1 -1
  202. package/src/column/edit.native.js +1 -1
  203. package/src/comments/edit/comments-inspector-controls.js +1 -0
  204. package/src/cover/edit/index.js +1 -0
  205. package/src/cover/edit/inspector-controls.js +1 -0
  206. package/src/cover/style.scss +1 -1
  207. package/src/cover/test/edit.js +1 -1
  208. package/src/details/edit.js +0 -1
  209. package/src/editor.scss +6 -6
  210. package/src/file/edit.js +11 -10
  211. package/src/file/index.php +30 -11
  212. package/src/file/view.js +5 -7
  213. package/src/form/index.js +1 -1
  214. package/src/form-submit-button/edit.js +1 -0
  215. package/src/gallery/gap-styles.js +10 -9
  216. package/src/gallery/style.scss +1 -0
  217. package/src/group/edit.js +4 -11
  218. package/src/heading/test/__snapshots__/index.native.js.snap +6 -0
  219. package/src/heading/test/index.native.js +40 -0
  220. package/src/html/transforms.js +5 -2
  221. package/src/image/block.json +2 -3
  222. package/src/image/deprecated.js +8 -0
  223. package/src/image/edit.js +16 -21
  224. package/src/image/edit.native.js +17 -18
  225. package/src/image/image.js +48 -51
  226. package/src/image/index.php +57 -49
  227. package/src/image/style.scss +18 -13
  228. package/src/image/view.js +281 -324
  229. package/src/missing/block.json +1 -1
  230. package/src/navigation/edit/overlay-menu-preview.js +1 -1
  231. package/src/navigation/index.php +46 -402
  232. package/src/navigation/use-template-part-area-label.js +4 -2
  233. package/src/navigation/view.js +159 -192
  234. package/src/navigation-link/block.json +2 -1
  235. package/src/navigation-link/edit.js +2 -2
  236. package/src/navigation-link/index.php +57 -0
  237. package/src/paragraph/test/__snapshots__/transforms.native.js.snap +6 -0
  238. package/src/paragraph/test/edit.native.js +37 -1
  239. package/src/paragraph/test/transforms.native.js +1 -0
  240. package/src/pattern/edit.js +7 -4
  241. package/src/pattern/index.php +6 -1
  242. package/src/post-author/edit.js +0 -1
  243. package/src/post-featured-image/edit.js +38 -5
  244. package/src/post-featured-image/editor.scss +19 -0
  245. package/src/post-template/block.json +0 -1
  246. package/src/post-template/edit.js +1 -5
  247. package/src/post-terms/edit.js +0 -2
  248. package/src/preformatted/transforms.js +1 -4
  249. package/src/query/edit/query-content.js +1 -0
  250. package/src/query/index.php +42 -24
  251. package/src/query/view.js +58 -65
  252. package/src/query-pagination-next/index.php +3 -3
  253. package/src/query-pagination-numbers/index.php +1 -1
  254. package/src/query-pagination-previous/index.php +3 -3
  255. package/src/quote/block.json +6 -0
  256. package/src/quote/style.scss +4 -0
  257. package/src/read-more/style.scss +1 -1
  258. package/src/search/index.php +40 -40
  259. package/src/search/view.js +58 -63
  260. package/src/template-part/edit/advanced-controls.js +1 -0
  261. package/src/template-part/edit/index.js +7 -14
  262. package/src/template-part/index.js +4 -3
  263. package/src/template-part/index.php +4 -4
  264. package/src/template-part/variations.js +4 -2
  265. package/src/utils/remove-anchor-tag.js +10 -0
  266. package/tsconfig.json +1 -0
@@ -840,20 +840,20 @@
840
840
  color: inherit;
841
841
  /*rtl:raw: direction: rtl; */
842
842
  }
843
- .wp-block-cover-image p:not(.has-text-color),
844
- .wp-block-cover-image h1:not(.has-text-color),
845
- .wp-block-cover-image h2:not(.has-text-color),
846
- .wp-block-cover-image h3:not(.has-text-color),
847
- .wp-block-cover-image h4:not(.has-text-color),
848
- .wp-block-cover-image h5:not(.has-text-color),
849
- .wp-block-cover-image h6:not(.has-text-color),
850
- .wp-block-cover p:not(.has-text-color),
851
- .wp-block-cover h1:not(.has-text-color),
852
- .wp-block-cover h2:not(.has-text-color),
853
- .wp-block-cover h3:not(.has-text-color),
854
- .wp-block-cover h4:not(.has-text-color),
855
- .wp-block-cover h5:not(.has-text-color),
856
- .wp-block-cover h6:not(.has-text-color) {
843
+ .wp-block-cover-image p:where(:not(.has-text-color)),
844
+ .wp-block-cover-image h1:where(:not(.has-text-color)),
845
+ .wp-block-cover-image h2:where(:not(.has-text-color)),
846
+ .wp-block-cover-image h3:where(:not(.has-text-color)),
847
+ .wp-block-cover-image h4:where(:not(.has-text-color)),
848
+ .wp-block-cover-image h5:where(:not(.has-text-color)),
849
+ .wp-block-cover-image h6:where(:not(.has-text-color)),
850
+ .wp-block-cover p:where(:not(.has-text-color)),
851
+ .wp-block-cover h1:where(:not(.has-text-color)),
852
+ .wp-block-cover h2:where(:not(.has-text-color)),
853
+ .wp-block-cover h3:where(:not(.has-text-color)),
854
+ .wp-block-cover h4:where(:not(.has-text-color)),
855
+ .wp-block-cover h5:where(:not(.has-text-color)),
856
+ .wp-block-cover h6:where(:not(.has-text-color)) {
857
857
  color: inherit;
858
858
  }
859
859
  .wp-block-cover-image.is-position-top-left,
@@ -1439,6 +1439,34 @@ figure.wp-block-gallery.has-nested-images {
1439
1439
  text-align: center;
1440
1440
  width: 100%;
1441
1441
  box-sizing: border-box;
1442
+ scrollbar-width: thin;
1443
+ scrollbar-gutter: stable both-edges;
1444
+ scrollbar-color: transparent transparent;
1445
+ will-change: transform;
1446
+ }
1447
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar {
1448
+ width: 12px;
1449
+ height: 12px;
1450
+ }
1451
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-track {
1452
+ background-color: transparent;
1453
+ }
1454
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption::-webkit-scrollbar-thumb {
1455
+ background-color: transparent;
1456
+ border-radius: 8px;
1457
+ border: 3px solid transparent;
1458
+ background-clip: padding-box;
1459
+ }
1460
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover::-webkit-scrollbar-thumb, .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus::-webkit-scrollbar-thumb, .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within::-webkit-scrollbar-thumb {
1461
+ background-color: rgba(255, 255, 255, 0.8);
1462
+ }
1463
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:hover, .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus, .wp-block-gallery.has-nested-images figure.wp-block-image figcaption:focus-within {
1464
+ scrollbar-color: rgba(255, 255, 255, 0.8) transparent;
1465
+ }
1466
+ @media (hover: none) {
1467
+ .wp-block-gallery.has-nested-images figure.wp-block-image figcaption {
1468
+ scrollbar-color: rgba(255, 255, 255, 0.8) transparent;
1469
+ }
1442
1470
  }
1443
1471
  .wp-block-gallery.has-nested-images figure.wp-block-image figcaption img {
1444
1472
  display: inline;
@@ -1686,22 +1714,28 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1686
1714
  .wp-lightbox-container button {
1687
1715
  opacity: 0;
1688
1716
  border: none;
1689
- background: #000;
1717
+ background-color: rgba(90, 90, 90, 0.25);
1718
+ -webkit-backdrop-filter: blur(16px) saturate(180%);
1719
+ backdrop-filter: blur(16px) saturate(180%);
1690
1720
  cursor: zoom-in;
1691
- width: 24px;
1692
- height: 24px;
1721
+ display: flex;
1722
+ justify-content: center;
1723
+ align-items: center;
1724
+ width: 20px;
1725
+ height: 20px;
1693
1726
  position: absolute;
1694
1727
  z-index: 100;
1695
- top: 10px;
1696
- right: 10px;
1728
+ top: 16px;
1729
+ right: 16px;
1697
1730
  text-align: center;
1698
1731
  padding: 0;
1699
- border-radius: 10%;
1732
+ border-radius: 4px;
1733
+ transition: opacity 0.2s ease;
1700
1734
  }
1701
1735
  .wp-lightbox-container button:focus-visible {
1702
- outline: 5px auto #212121;
1703
- outline: 5px auto -webkit-focus-ring-color;
1704
- outline-offset: 5px;
1736
+ outline: 3px auto rgba(90, 90, 90, 0.25);
1737
+ outline: 3px auto -webkit-focus-ring-color;
1738
+ outline-offset: 3px;
1705
1739
  }
1706
1740
  .wp-lightbox-container button:hover {
1707
1741
  cursor: pointer;
@@ -1711,7 +1745,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1711
1745
  opacity: 1;
1712
1746
  }
1713
1747
  .wp-lightbox-container button:hover, .wp-lightbox-container button:focus, .wp-lightbox-container button:not(:hover):not(:active):not(.has-background) {
1714
- background: #000;
1748
+ background-color: rgba(90, 90, 90, 0.25);
1715
1749
  border: none;
1716
1750
  }
1717
1751
 
@@ -1721,7 +1755,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1721
1755
  left: 0;
1722
1756
  z-index: 100000;
1723
1757
  overflow: hidden;
1724
- width: 100vw;
1758
+ width: 100%;
1725
1759
  height: 100vh;
1726
1760
  box-sizing: border-box;
1727
1761
  visibility: hidden;
@@ -1854,7 +1888,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1854
1888
  }
1855
1889
  @keyframes lightbox-zoom-in {
1856
1890
  0% {
1857
- transform: translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
1891
+ transform: translate(calc((-100vw + var(--wp--lightbox-scrollbar-width)) / 2 + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
1858
1892
  }
1859
1893
  100% {
1860
1894
  transform: translate(-50%, -50%) scale(1, 1);
@@ -1870,7 +1904,7 @@ h6.has-text-align-left[style*=writing-mode]:where([style*="vertical-lr"]) {
1870
1904
  }
1871
1905
  100% {
1872
1906
  visibility: hidden;
1873
- transform: translate(calc(-50vw + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
1907
+ transform: translate(calc((-100vw + var(--wp--lightbox-scrollbar-width)) / 2 + var(--wp--lightbox-initial-left-position)), calc(-50vh + var(--wp--lightbox-initial-top-position))) scale(var(--wp--lightbox-scale));
1874
1908
  }
1875
1909
  }
1876
1910
  ol.wp-block-latest-comments {
@@ -3150,16 +3184,19 @@ p.has-text-align-left[style*="writing-mode:vertical-lr"] {
3150
3184
  font-size: 1.125em;
3151
3185
  text-align: right;
3152
3186
  }
3187
+ .wp-block-quote > cite {
3188
+ display: block;
3189
+ }
3153
3190
 
3154
3191
  .wp-block-read-more {
3155
3192
  display: block;
3156
3193
  width: -moz-fit-content;
3157
3194
  width: fit-content;
3158
3195
  }
3159
- .wp-block-read-more:not([style*=text-decoration]) {
3196
+ .wp-block-read-more:where(:not([style*="text-decoration"])) {
3160
3197
  text-decoration: none;
3161
3198
  }
3162
- .wp-block-read-more:not([style*=text-decoration]):focus, .wp-block-read-more:not([style*=text-decoration]):active {
3199
+ .wp-block-read-more:where(:not([style*="text-decoration"])):focus, .wp-block-read-more:where(:not([style*="text-decoration"])):active {
3163
3200
  text-decoration: none;
3164
3201
  }
3165
3202
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.22.0",
3
+ "version": "8.24.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,36 +31,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.45.0",
35
- "@wordpress/api-fetch": "^6.42.0",
36
- "@wordpress/autop": "^3.45.0",
37
- "@wordpress/blob": "^3.45.0",
38
- "@wordpress/block-editor": "^12.13.0",
39
- "@wordpress/blocks": "^12.22.0",
40
- "@wordpress/components": "^25.11.0",
41
- "@wordpress/compose": "^6.22.0",
42
- "@wordpress/core-data": "^6.22.0",
43
- "@wordpress/data": "^9.15.0",
44
- "@wordpress/date": "^4.45.0",
45
- "@wordpress/deprecated": "^3.45.0",
46
- "@wordpress/dom": "^3.45.0",
47
- "@wordpress/element": "^5.22.0",
48
- "@wordpress/escape-html": "^2.45.0",
49
- "@wordpress/hooks": "^3.45.0",
50
- "@wordpress/html-entities": "^3.45.0",
51
- "@wordpress/i18n": "^4.45.0",
52
- "@wordpress/icons": "^9.36.0",
53
- "@wordpress/interactivity": "^2.6.0",
54
- "@wordpress/keycodes": "^3.45.0",
55
- "@wordpress/notices": "^4.13.0",
56
- "@wordpress/primitives": "^3.43.0",
57
- "@wordpress/private-apis": "^0.27.0",
58
- "@wordpress/reusable-blocks": "^4.22.0",
59
- "@wordpress/rich-text": "^6.22.0",
60
- "@wordpress/server-side-render": "^4.22.0",
61
- "@wordpress/url": "^3.46.0",
62
- "@wordpress/viewport": "^5.22.0",
63
- "@wordpress/wordcount": "^3.45.0",
34
+ "@wordpress/a11y": "^3.47.0",
35
+ "@wordpress/api-fetch": "^6.44.0",
36
+ "@wordpress/autop": "^3.47.0",
37
+ "@wordpress/blob": "^3.47.0",
38
+ "@wordpress/block-editor": "^12.15.0",
39
+ "@wordpress/blocks": "^12.24.0",
40
+ "@wordpress/components": "^25.13.0",
41
+ "@wordpress/compose": "^6.24.0",
42
+ "@wordpress/core-data": "^6.24.0",
43
+ "@wordpress/data": "^9.17.0",
44
+ "@wordpress/date": "^4.47.0",
45
+ "@wordpress/deprecated": "^3.47.0",
46
+ "@wordpress/dom": "^3.47.0",
47
+ "@wordpress/element": "^5.24.0",
48
+ "@wordpress/escape-html": "^2.47.0",
49
+ "@wordpress/hooks": "^3.47.0",
50
+ "@wordpress/html-entities": "^3.47.0",
51
+ "@wordpress/i18n": "^4.47.0",
52
+ "@wordpress/icons": "^9.38.0",
53
+ "@wordpress/interactivity": "^3.0.0",
54
+ "@wordpress/keycodes": "^3.47.0",
55
+ "@wordpress/notices": "^4.15.0",
56
+ "@wordpress/primitives": "^3.45.0",
57
+ "@wordpress/private-apis": "^0.29.0",
58
+ "@wordpress/reusable-blocks": "^4.24.0",
59
+ "@wordpress/rich-text": "^6.24.0",
60
+ "@wordpress/server-side-render": "^4.24.0",
61
+ "@wordpress/url": "^3.48.0",
62
+ "@wordpress/viewport": "^5.24.0",
63
+ "@wordpress/wordcount": "^3.47.0",
64
64
  "change-case": "^4.1.2",
65
65
  "classnames": "^2.3.1",
66
66
  "colord": "^2.7.0",
@@ -78,5 +78,5 @@
78
78
  "publishConfig": {
79
79
  "access": "public"
80
80
  },
81
- "gitHead": "2a00e87b57b9c27ed2b9b0fd8d423ef3cada72c1"
81
+ "gitHead": "d98dff8ea96f29cfea045bf964269f46f040d539"
82
82
  }
package/src/block/edit.js CHANGED
@@ -114,33 +114,28 @@ export default function ReusableBlockEdit( {
114
114
  : InnerBlocks.ButtonBlockAppender,
115
115
  } );
116
116
 
117
+ let children = null;
117
118
  if ( hasAlreadyRendered ) {
118
- return (
119
- <div { ...blockProps }>
120
- <Warning>
121
- { __( 'Block cannot be rendered inside itself.' ) }
122
- </Warning>
123
- </div>
119
+ children = (
120
+ <Warning>
121
+ { __( 'Block cannot be rendered inside itself.' ) }
122
+ </Warning>
124
123
  );
125
124
  }
126
125
 
127
126
  if ( isMissing ) {
128
- return (
129
- <div { ...blockProps }>
130
- <Warning>
131
- { __( 'Block has been deleted or is unavailable.' ) }
132
- </Warning>
133
- </div>
127
+ children = (
128
+ <Warning>
129
+ { __( 'Block has been deleted or is unavailable.' ) }
130
+ </Warning>
134
131
  );
135
132
  }
136
133
 
137
134
  if ( ! hasResolved ) {
138
- return (
139
- <div { ...blockProps }>
140
- <Placeholder>
141
- <Spinner />
142
- </Placeholder>
143
- </div>
135
+ children = (
136
+ <Placeholder>
137
+ <Spinner />
138
+ </Placeholder>
144
139
  );
145
140
  }
146
141
 
@@ -149,14 +144,19 @@ export default function ReusableBlockEdit( {
149
144
  <InspectorControls>
150
145
  <PanelBody>
151
146
  <TextControl
152
- __nextHasNoMarginBottom
153
147
  label={ __( 'Name' ) }
154
148
  value={ title }
155
149
  onChange={ setTitle }
150
+ __nextHasNoMarginBottom
151
+ __next40pxDefaultSize
156
152
  />
157
153
  </PanelBody>
158
154
  </InspectorControls>
159
- <div { ...innerBlocksProps } />
155
+ { children === null ? (
156
+ <div { ...innerBlocksProps } />
157
+ ) : (
158
+ <div { ...blockProps }>{ children }</div>
159
+ ) }
160
160
  </RecursionProvider>
161
161
  );
162
162
  }
@@ -78,7 +78,7 @@ export default function ReusableBlockEdit( {
78
78
  styles.spinnerDark
79
79
  );
80
80
 
81
- const { hasResolved, isEditing, isMissing, innerBlockCount } = useSelect(
81
+ const { hasResolved, isEditing, isMissing } = useSelect(
82
82
  ( select ) => {
83
83
  const persistedBlock = select( coreStore ).getEntityRecord(
84
84
  'postType',
@@ -176,20 +176,12 @@ export default function ReusableBlockEdit( {
176
176
  { infoTitle }
177
177
  </Text>
178
178
  <Text style={ [ infoTextStyle, infoDescriptionStyle ] }>
179
- { innerBlockCount > 1
180
- ? __(
181
- 'Alternatively, you can detach and edit these blocks separately by tapping “Detach patterns”.'
182
- )
183
- : __(
184
- 'Alternatively, you can detach and edit this block separately by tapping “Detach pattern”.'
185
- ) }
179
+ { __(
180
+ 'Alternatively, you can detach and edit this block separately by tapping “Detach”.'
181
+ ) }
186
182
  </Text>
187
183
  <TextControl
188
- label={
189
- innerBlockCount > 1
190
- ? __( 'Detach patterns' )
191
- : __( 'Detach pattern' )
192
- }
184
+ label={ __( 'Detach' ) }
193
185
  separatorType="topFullWidth"
194
186
  onPress={ onConvertToRegularBlocks }
195
187
  labelStyle={ actionButtonStyle }
@@ -8,6 +8,7 @@ import classnames from 'classnames';
8
8
  */
9
9
  import { NEW_TAB_TARGET, NOFOLLOW_REL } from './constants';
10
10
  import { getUpdatedLinkAttributes } from './get-updated-link-attributes';
11
+ import removeAnchorTag from '../utils/remove-anchor-tag';
11
12
 
12
13
  /**
13
14
  * WordPress dependencies
@@ -33,11 +34,17 @@ import {
33
34
  __experimentalGetSpacingClassesAndStyles as useSpacingProps,
34
35
  __experimentalLinkControl as LinkControl,
35
36
  __experimentalGetElementClassName,
37
+ store as blockEditorStore,
36
38
  } from '@wordpress/block-editor';
37
- import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
39
+ import { displayShortcut, isKeyboardEvent, ENTER } from '@wordpress/keycodes';
38
40
  import { link, linkOff } from '@wordpress/icons';
39
- import { createBlock } from '@wordpress/blocks';
40
- import { useMergeRefs } from '@wordpress/compose';
41
+ import {
42
+ createBlock,
43
+ cloneBlock,
44
+ getDefaultBlockName,
45
+ } from '@wordpress/blocks';
46
+ import { useMergeRefs, useRefEffect } from '@wordpress/compose';
47
+ import { useSelect, useDispatch } from '@wordpress/data';
41
48
 
42
49
  const LINK_SETTINGS = [
43
50
  ...LinkControl.DEFAULT_LINK_SETTINGS,
@@ -47,6 +54,62 @@ const LINK_SETTINGS = [
47
54
  },
48
55
  ];
49
56
 
57
+ function useEnter( props ) {
58
+ const { replaceBlocks, selectionChange } = useDispatch( blockEditorStore );
59
+ const { getBlock, getBlockRootClientId, getBlockIndex } =
60
+ useSelect( blockEditorStore );
61
+ const propsRef = useRef( props );
62
+ propsRef.current = props;
63
+ return useRefEffect( ( element ) => {
64
+ function onKeyDown( event ) {
65
+ if ( event.defaultPrevented || event.keyCode !== ENTER ) {
66
+ return;
67
+ }
68
+ const { content, clientId } = propsRef.current;
69
+ if ( content.length ) {
70
+ return;
71
+ }
72
+ event.preventDefault();
73
+ const topParentListBlock = getBlock(
74
+ getBlockRootClientId( clientId )
75
+ );
76
+ const blockIndex = getBlockIndex( clientId );
77
+ const head = cloneBlock( {
78
+ ...topParentListBlock,
79
+ innerBlocks: topParentListBlock.innerBlocks.slice(
80
+ 0,
81
+ blockIndex
82
+ ),
83
+ } );
84
+ const middle = createBlock( getDefaultBlockName() );
85
+ const after = topParentListBlock.innerBlocks.slice(
86
+ blockIndex + 1
87
+ );
88
+ const tail = after.length
89
+ ? [
90
+ cloneBlock( {
91
+ ...topParentListBlock,
92
+ innerBlocks: after,
93
+ } ),
94
+ ]
95
+ : [];
96
+ replaceBlocks(
97
+ topParentListBlock.clientId,
98
+ [ head, middle, ...tail ],
99
+ 1
100
+ );
101
+ // We manually change the selection here because we are replacing
102
+ // a different block than the selected one.
103
+ selectionChange( middle.clientId );
104
+ }
105
+
106
+ element.addEventListener( 'keydown', onKeyDown );
107
+ return () => {
108
+ element.removeEventListener( 'keydown', onKeyDown );
109
+ };
110
+ }, [] );
111
+ }
112
+
50
113
  function WidthPanel( { selectedWidth, setAttributes } ) {
51
114
  function handleChange( newWidth ) {
52
115
  // Check if we are toggling the width off
@@ -88,6 +151,7 @@ function ButtonEdit( props ) {
88
151
  isSelected,
89
152
  onReplace,
90
153
  mergeBlocks,
154
+ clientId,
91
155
  } = props;
92
156
  const {
93
157
  tagName,
@@ -103,11 +167,6 @@ function ButtonEdit( props ) {
103
167
 
104
168
  const TagName = tagName || 'a';
105
169
 
106
- function setButtonText( newText ) {
107
- // Remove anchor tags from button text content.
108
- setAttributes( { text: newText.replace( /<\/?a[^>]*>/g, '' ) } );
109
- }
110
-
111
170
  function onKeyDown( event ) {
112
171
  if ( isKeyboardEvent.primary( event, 'k' ) ) {
113
172
  startEditing( event );
@@ -164,6 +223,9 @@ function ButtonEdit( props ) {
164
223
  [ url, opensInNewTab, nofollow ]
165
224
  );
166
225
 
226
+ const useEnterRef = useEnter( { content: text, clientId } );
227
+ const mergedRef = useMergeRefs( [ useEnterRef, richTextRef ] );
228
+
167
229
  return (
168
230
  <>
169
231
  <div
@@ -175,11 +237,15 @@ function ButtonEdit( props ) {
175
237
  } ) }
176
238
  >
177
239
  <RichText
178
- ref={ richTextRef }
240
+ ref={ mergedRef }
179
241
  aria-label={ __( 'Button text' ) }
180
242
  placeholder={ placeholder || __( 'Add text…' ) }
181
243
  value={ text }
182
- onChange={ ( value ) => setButtonText( value ) }
244
+ onChange={ ( value ) =>
245
+ setAttributes( {
246
+ text: removeAnchorTag( value ),
247
+ } )
248
+ }
183
249
  withoutInteractiveFormatting
184
250
  className={ classnames(
185
251
  className,
@@ -71,9 +71,3 @@ exports[`Buttons block when a button is shown removing button along with buttons
71
71
  <p></p>
72
72
  <!-- /wp:paragraph -->"
73
73
  `;
74
-
75
- exports[`Buttons block when a button is shown removing button along with buttons block removes the button and buttons block when deleting the block using the delete (backspace) key 1`] = `
76
- "<!-- wp:paragraph -->
77
- <p></p>
78
- <!-- /wp:paragraph -->"
79
- `;
@@ -18,7 +18,6 @@ import {
18
18
  */
19
19
  import { getBlockTypes, unregisterBlockType } from '@wordpress/blocks';
20
20
  import { registerCoreBlocks } from '@wordpress/block-library';
21
- import { BACKSPACE } from '@wordpress/keycodes';
22
21
 
23
22
  const BUTTONS_HTML = `<!-- wp:buttons -->
24
23
  <div class="wp-block-buttons"><!-- wp:button /--></div>
@@ -238,32 +237,6 @@ describe( 'Buttons block', () => {
238
237
 
239
238
  expect( getEditorHtml() ).toMatchSnapshot();
240
239
  } );
241
-
242
- it( 'removes the button and buttons block when deleting the block using the delete (backspace) key', async () => {
243
- const screen = await initializeEditor( {
244
- initialHtml: BUTTONS_HTML,
245
- } );
246
-
247
- // Get block
248
- const buttonsBlock = await getBlock( screen, 'Buttons' );
249
- triggerBlockListLayout( buttonsBlock );
250
-
251
- // Get inner button block
252
- const buttonBlock = await getBlock( screen, 'Button' );
253
- fireEvent.press( buttonBlock );
254
-
255
- const buttonInput =
256
- within( buttonBlock ).getByLabelText( 'Text input. Empty' );
257
-
258
- // Delete block
259
- fireEvent( buttonInput, 'onKeyDown', {
260
- nativeEvent: {},
261
- preventDefault() {},
262
- keyCode: BACKSPACE,
263
- } );
264
-
265
- expect( getEditorHtml() ).toMatchSnapshot();
266
- } );
267
240
  } );
268
241
  } );
269
242
 
@@ -2,6 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { createBlock } from '@wordpress/blocks';
5
+ import { create, toHTMLString } from '@wordpress/rich-text';
5
6
 
6
7
  const transforms = {
7
8
  from: [
@@ -12,10 +13,18 @@ const transforms = {
12
13
  },
13
14
  {
14
15
  type: 'block',
15
- blocks: [ 'core/html', 'core/paragraph' ],
16
- transform: ( { content } ) => {
16
+ blocks: [ 'core/paragraph' ],
17
+ transform: ( { content } ) =>
18
+ createBlock( 'core/code', { content } ),
19
+ },
20
+ {
21
+ type: 'block',
22
+ blocks: [ 'core/html' ],
23
+ transform: ( { content: text } ) => {
17
24
  return createBlock( 'core/code', {
18
- content,
25
+ // The HTML is plain text (with plain line breaks), so
26
+ // convert it to rich text.
27
+ content: toHTMLString( { value: create( { text } ) } ),
19
28
  } );
20
29
  },
21
30
  },
@@ -42,11 +51,8 @@ const transforms = {
42
51
  {
43
52
  type: 'block',
44
53
  blocks: [ 'core/paragraph' ],
45
- transform: ( { content } ) => {
46
- return createBlock( 'core/paragraph', {
47
- content: content.replace( /\n/g, '<br>' ),
48
- } );
49
- },
54
+ transform: ( { content } ) =>
55
+ createBlock( 'core/paragraph', { content } ),
50
56
  },
51
57
  ],
52
58
  };
@@ -103,7 +103,7 @@ function ColumnEdit( {
103
103
  />
104
104
  </BlockControls>
105
105
  <InspectorControls>
106
- <PanelBody title={ __( 'Column settings' ) }>
106
+ <PanelBody title={ __( 'Settings' ) }>
107
107
  <UnitControl
108
108
  label={ __( 'Width' ) }
109
109
  labelPosition="edge"
@@ -160,7 +160,7 @@ function ColumnEdit( {
160
160
  />
161
161
  </BlockControls>
162
162
  <InspectorControls>
163
- <PanelBody title={ __( 'Column settings' ) }>
163
+ <PanelBody title={ __( 'Settings' ) }>
164
164
  <UnitControl
165
165
  label={ __( 'Width' ) }
166
166
  min={ 1 }
@@ -22,6 +22,7 @@ export default function CommentsInspectorControls( {
22
22
  <InspectorControls group="advanced">
23
23
  <SelectControl
24
24
  __nextHasNoMarginBottom
25
+ __next40pxDefaultSize
25
26
  label={ __( 'HTML element' ) }
26
27
  options={ [
27
28
  { label: __( 'Default (<div>)' ), value: 'div' },
@@ -335,6 +335,7 @@ function CoverEdit( {
335
335
  templateInsertUpdatesSelection: true,
336
336
  allowedBlocks,
337
337
  templateLock,
338
+ dropZoneElement: ref.current,
338
339
  }
339
340
  );
340
341
 
@@ -319,6 +319,7 @@ export default function CoverInspectorControls( {
319
319
  <InspectorControls group="advanced">
320
320
  <SelectControl
321
321
  __nextHasNoMarginBottom
322
+ __next40pxDefaultSize
322
323
  label={ __( 'HTML element' ) }
323
324
  options={ [
324
325
  { label: __( 'Default (<div>)' ), value: 'div' },
@@ -123,7 +123,7 @@
123
123
  h4,
124
124
  h5,
125
125
  h6 {
126
- &:not(.has-text-color) {
126
+ &:where(:not(.has-text-color)) {
127
127
  color: inherit;
128
128
  }
129
129
  }
@@ -53,7 +53,7 @@ async function createAndSelectBlock() {
53
53
  );
54
54
  await userEvent.click(
55
55
  screen.getByRole( 'button', {
56
- name: 'Select Cover',
56
+ name: 'Select parent block: Cover',
57
57
  } )
58
58
  );
59
59
  }
@@ -72,7 +72,6 @@ function DetailsEdit( { attributes, setAttributes, clientId } ) {
72
72
  onChange={ ( newSummary ) =>
73
73
  setAttributes( { summary: newSummary } )
74
74
  }
75
- multiline={ false }
76
75
  />
77
76
  </summary>
78
77
  { innerBlocksProps.children }