@wordpress/block-library 8.3.2 → 8.4.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 (193) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +3 -1
  3. package/build/button/edit.js.map +1 -1
  4. package/build/button/index.js +17 -6
  5. package/build/button/index.js.map +1 -1
  6. package/build/cover/edit/index.js +3 -2
  7. package/build/cover/edit/index.js.map +1 -1
  8. package/build/file/index.js +10 -1
  9. package/build/file/index.js.map +1 -1
  10. package/build/image/image.js +21 -15
  11. package/build/image/image.js.map +1 -1
  12. package/build/latest-comments/edit.js +6 -2
  13. package/build/latest-comments/edit.js.map +1 -1
  14. package/build/latest-comments/index.js +13 -0
  15. package/build/latest-comments/index.js.map +1 -1
  16. package/build/navigation/edit/index.js +2 -28
  17. package/build/navigation/edit/index.js.map +1 -1
  18. package/build/navigation/edit/menu-inspector-controls.js +5 -6
  19. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  20. package/build/navigation/edit/navigation-menu-selector.js +14 -11
  21. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  22. package/build/navigation/edit/unsaved-inner-blocks.js +4 -5
  23. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  24. package/build/navigation/edit/use-create-navigation-menu.js +11 -2
  25. package/build/navigation/edit/use-create-navigation-menu.js.map +1 -1
  26. package/build/navigation/use-navigation-menu.js +1 -1
  27. package/build/navigation/use-navigation-menu.js.map +1 -1
  28. package/build/navigation-link/edit.js +4 -0
  29. package/build/navigation-link/edit.js.map +1 -1
  30. package/build/navigation-link/link-ui.js +1 -0
  31. package/build/navigation-link/link-ui.js.map +1 -1
  32. package/build/navigation-submenu/edit.js +4 -0
  33. package/build/navigation-submenu/edit.js.map +1 -1
  34. package/build/page-list/edit.js +5 -4
  35. package/build/page-list/edit.js.map +1 -1
  36. package/build/page-list/use-convert-to-navigation-links.js +61 -5
  37. package/build/page-list/use-convert-to-navigation-links.js.map +1 -1
  38. package/build/post-excerpt/edit.js +49 -3
  39. package/build/post-excerpt/edit.js.map +1 -1
  40. package/build/post-excerpt/index.js +4 -0
  41. package/build/post-excerpt/index.js.map +1 -1
  42. package/build/post-featured-image/dimension-controls.js +52 -1
  43. package/build/post-featured-image/dimension-controls.js.map +1 -1
  44. package/build/post-featured-image/edit.js +9 -4
  45. package/build/post-featured-image/edit.js.map +1 -1
  46. package/build/post-featured-image/index.js +3 -0
  47. package/build/post-featured-image/index.js.map +1 -1
  48. package/build/{experiments.js → private-apis.js} +3 -3
  49. package/build/private-apis.js.map +1 -0
  50. package/build/site-logo/edit.js +7 -11
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/table/edit.js +3 -3
  53. package/build/table/edit.js.map +1 -1
  54. package/build/table-of-contents/utils.js +1 -1
  55. package/build/table-of-contents/utils.js.map +1 -1
  56. package/build/verse/index.js +6 -0
  57. package/build/verse/index.js.map +1 -1
  58. package/build-module/button/edit.js +2 -1
  59. package/build-module/button/edit.js.map +1 -1
  60. package/build-module/button/index.js +17 -6
  61. package/build-module/button/index.js.map +1 -1
  62. package/build-module/cover/edit/index.js +3 -2
  63. package/build-module/cover/edit/index.js.map +1 -1
  64. package/build-module/file/index.js +10 -1
  65. package/build-module/file/index.js.map +1 -1
  66. package/build-module/image/image.js +21 -15
  67. package/build-module/image/image.js.map +1 -1
  68. package/build-module/latest-comments/edit.js +6 -2
  69. package/build-module/latest-comments/edit.js.map +1 -1
  70. package/build-module/latest-comments/index.js +13 -0
  71. package/build-module/latest-comments/index.js.map +1 -1
  72. package/build-module/navigation/edit/index.js +3 -29
  73. package/build-module/navigation/edit/index.js.map +1 -1
  74. package/build-module/navigation/edit/menu-inspector-controls.js +5 -5
  75. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  76. package/build-module/navigation/edit/navigation-menu-selector.js +14 -10
  77. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  78. package/build-module/navigation/edit/unsaved-inner-blocks.js +4 -5
  79. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  80. package/build-module/navigation/edit/use-create-navigation-menu.js +11 -2
  81. package/build-module/navigation/edit/use-create-navigation-menu.js.map +1 -1
  82. package/build-module/navigation/use-navigation-menu.js +1 -1
  83. package/build-module/navigation/use-navigation-menu.js.map +1 -1
  84. package/build-module/navigation-link/edit.js +4 -0
  85. package/build-module/navigation-link/edit.js.map +1 -1
  86. package/build-module/navigation-link/link-ui.js +1 -0
  87. package/build-module/navigation-link/link-ui.js.map +1 -1
  88. package/build-module/navigation-submenu/edit.js +4 -0
  89. package/build-module/navigation-submenu/edit.js.map +1 -1
  90. package/build-module/page-list/edit.js +5 -4
  91. package/build-module/page-list/edit.js.map +1 -1
  92. package/build-module/page-list/use-convert-to-navigation-links.js +61 -5
  93. package/build-module/page-list/use-convert-to-navigation-links.js.map +1 -1
  94. package/build-module/post-excerpt/edit.js +52 -5
  95. package/build-module/post-excerpt/edit.js.map +1 -1
  96. package/build-module/post-excerpt/index.js +4 -0
  97. package/build-module/post-excerpt/index.js.map +1 -1
  98. package/build-module/post-featured-image/dimension-controls.js +52 -1
  99. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  100. package/build-module/post-featured-image/edit.js +9 -4
  101. package/build-module/post-featured-image/edit.js.map +1 -1
  102. package/build-module/post-featured-image/index.js +3 -0
  103. package/build-module/post-featured-image/index.js.map +1 -1
  104. package/build-module/{experiments.js → private-apis.js} +2 -2
  105. package/build-module/private-apis.js.map +1 -0
  106. package/build-module/site-logo/edit.js +7 -11
  107. package/build-module/site-logo/edit.js.map +1 -1
  108. package/build-module/table/edit.js +3 -3
  109. package/build-module/table/edit.js.map +1 -1
  110. package/build-module/table-of-contents/utils.js +1 -1
  111. package/build-module/table-of-contents/utils.js.map +1 -1
  112. package/build-module/verse/index.js +6 -0
  113. package/build-module/verse/index.js.map +1 -1
  114. package/build-style/avatar/style-rtl.css +3 -0
  115. package/build-style/avatar/style.css +3 -0
  116. package/build-style/button/editor-rtl.css +31 -0
  117. package/build-style/button/editor.css +31 -0
  118. package/build-style/button/style-rtl.css +31 -0
  119. package/build-style/button/style.css +31 -0
  120. package/build-style/classic-rtl.css +5 -0
  121. package/build-style/classic.css +5 -0
  122. package/build-style/editor-rtl.css +36 -1
  123. package/build-style/editor.css +36 -1
  124. package/build-style/file/style-rtl.css +1 -0
  125. package/build-style/file/style.css +1 -0
  126. package/build-style/image/editor-rtl.css +1 -0
  127. package/build-style/image/editor.css +1 -0
  128. package/build-style/image/style-rtl.css +6 -2
  129. package/build-style/image/style.css +6 -0
  130. package/build-style/latest-comments/style-rtl.css +18 -5
  131. package/build-style/latest-comments/style.css +18 -5
  132. package/build-style/quote/style-rtl.css +5 -5
  133. package/build-style/quote/style.css +5 -5
  134. package/build-style/style-rtl.css +64 -12
  135. package/build-style/style.css +64 -10
  136. package/build-types/table-of-contents/utils.d.ts +1 -1
  137. package/package.json +30 -30
  138. package/src/avatar/index.php +67 -63
  139. package/src/avatar/style.scss +3 -0
  140. package/src/button/block.json +17 -6
  141. package/src/button/edit.js +2 -1
  142. package/src/button/editor.scss +36 -0
  143. package/src/button/style.scss +37 -1
  144. package/src/classic.scss +5 -0
  145. package/src/cover/edit/index.js +4 -1
  146. package/src/editor.scss +5 -0
  147. package/src/file/block.json +10 -1
  148. package/src/file/style.scss +1 -0
  149. package/src/image/editor.scss +1 -0
  150. package/src/image/image.js +32 -27
  151. package/src/image/style.scss +13 -0
  152. package/src/latest-comments/block.json +13 -0
  153. package/src/latest-comments/edit.js +9 -2
  154. package/src/latest-comments/style.scss +25 -7
  155. package/src/navigation/edit/index.js +1 -30
  156. package/src/navigation/edit/menu-inspector-controls.js +3 -4
  157. package/src/navigation/edit/navigation-menu-selector.js +12 -26
  158. package/src/navigation/edit/test/navigation-menu-selector.js +638 -0
  159. package/src/navigation/edit/unsaved-inner-blocks.js +29 -36
  160. package/src/navigation/edit/use-create-navigation-menu.js +13 -1
  161. package/src/navigation/index.php +8 -6
  162. package/src/navigation/use-navigation-menu.js +1 -1
  163. package/src/navigation-link/edit.js +3 -0
  164. package/src/navigation-link/link-ui.js +1 -0
  165. package/src/navigation-submenu/edit.js +3 -0
  166. package/src/page-list/edit.js +6 -5
  167. package/src/page-list/index.php +4 -4
  168. package/src/page-list/test/convert-to-links-modal.js +134 -0
  169. package/src/page-list/use-convert-to-navigation-links.js +64 -4
  170. package/src/post-excerpt/block.json +4 -0
  171. package/src/post-excerpt/edit.js +72 -7
  172. package/src/post-excerpt/index.php +29 -5
  173. package/src/post-featured-image/block.json +3 -0
  174. package/src/post-featured-image/dimension-controls.js +64 -2
  175. package/src/post-featured-image/edit.js +18 -6
  176. package/src/post-featured-image/index.php +25 -9
  177. package/src/post-title/index.php +3 -3
  178. package/src/{experiments.js → private-apis.js} +1 -1
  179. package/src/quote/style.scss +2 -2
  180. package/src/site-logo/edit.js +3 -6
  181. package/src/table/edit.js +3 -3
  182. package/src/table-of-contents/utils.ts +1 -1
  183. package/src/template-part/index.php +1 -1
  184. package/src/verse/block.json +6 -0
  185. package/tsconfig.json +24 -1
  186. package/tsconfig.tsbuildinfo +1 -1
  187. package/build/experiments.js.map +0 -1
  188. package/build/navigation/leaf-more-menu.js +0 -95
  189. package/build/navigation/leaf-more-menu.js.map +0 -1
  190. package/build-module/experiments.js.map +0 -1
  191. package/build-module/navigation/leaf-more-menu.js +0 -76
  192. package/build-module/navigation/leaf-more-menu.js.map +0 -1
  193. package/src/navigation/leaf-more-menu.js +0 -93
@@ -98,6 +98,9 @@
98
98
  .wp-block-avatar {
99
99
  box-sizing: border-box;
100
100
  }
101
+ .wp-block-avatar img {
102
+ box-sizing: border-box;
103
+ }
101
104
  .wp-block-avatar.aligncenter {
102
105
  text-align: center;
103
106
  }
@@ -200,6 +203,37 @@
200
203
  background-image: none;
201
204
  }
202
205
 
206
+ .wp-block-button .wp-block-button__link:where(.has-border-color) {
207
+ border-width: initial;
208
+ }
209
+ .wp-block-button .wp-block-button__link:where([style*="border-top-color"]) {
210
+ border-top-width: initial;
211
+ }
212
+ .wp-block-button .wp-block-button__link:where([style*="border-right-color"]) {
213
+ border-right-width: initial;
214
+ }
215
+ .wp-block-button .wp-block-button__link:where([style*="border-bottom-color"]) {
216
+ border-bottom-width: initial;
217
+ }
218
+ .wp-block-button .wp-block-button__link:where([style*="border-left-color"]) {
219
+ border-left-width: initial;
220
+ }
221
+ .wp-block-button .wp-block-button__link:where([style*="border-style"]) {
222
+ border-width: initial;
223
+ }
224
+ .wp-block-button .wp-block-button__link:where([style*="border-top-style"]) {
225
+ border-top-width: initial;
226
+ }
227
+ .wp-block-button .wp-block-button__link:where([style*="border-right-style"]) {
228
+ border-right-width: initial;
229
+ }
230
+ .wp-block-button .wp-block-button__link:where([style*="border-bottom-style"]) {
231
+ border-bottom-width: initial;
232
+ }
233
+ .wp-block-button .wp-block-button__link:where([style*="border-left-style"]) {
234
+ border-left-width: initial;
235
+ }
236
+
203
237
  .wp-block-buttons {
204
238
  /* stylelint-disable indentation */
205
239
  }
@@ -1073,6 +1107,7 @@ section.wp-block-cover-image > h2,
1073
1107
  :where(.wp-block-file__button) {
1074
1108
  border-radius: 2em;
1075
1109
  padding: 0.5em 1em;
1110
+ display: inline-block;
1076
1111
  }
1077
1112
  :where(.wp-block-file__button):is(a):hover, :where(.wp-block-file__button):is(a):visited, :where(.wp-block-file__button):is(a):focus, :where(.wp-block-file__button):is(a):active {
1078
1113
  box-shadow: none;
@@ -1422,6 +1457,10 @@ h6.has-background {
1422
1457
  vertical-align: bottom;
1423
1458
  box-sizing: border-box;
1424
1459
  }
1460
+ .wp-block-image[style*=border-radius] > a,
1461
+ .wp-block-image[style*=border-radius] img {
1462
+ border-radius: inherit;
1463
+ }
1425
1464
  .wp-block-image.has-custom-border img {
1426
1465
  box-sizing: border-box;
1427
1466
  }
@@ -1450,6 +1489,7 @@ h6.has-background {
1450
1489
  float: left;
1451
1490
  /*rtl:ignore*/
1452
1491
  margin-left: 0;
1492
+ /*rtl:ignore*/
1453
1493
  margin-right: 1em;
1454
1494
  margin-top: 0.5em;
1455
1495
  margin-bottom: 0.5em;
@@ -1459,6 +1499,7 @@ h6.has-background {
1459
1499
  float: right;
1460
1500
  /*rtl:ignore*/
1461
1501
  margin-right: 0;
1502
+ /*rtl:ignore*/
1462
1503
  margin-left: 1em;
1463
1504
  margin-top: 0.5em;
1464
1505
  margin-bottom: 0.5em;
@@ -1534,12 +1575,24 @@ ol.wp-block-latest-comments {
1534
1575
  box-sizing: border-box;
1535
1576
  }
1536
1577
 
1578
+ :where(.wp-block-latest-comments:not([style*="line-height"] .wp-block-latest-comments__comment)) {
1579
+ line-height: 1.1;
1580
+ }
1581
+
1582
+ :where(.wp-block-latest-comments:not([style*="line-height"] .wp-block-latest-comments__comment-excerpt p)) {
1583
+ line-height: 1.8;
1584
+ }
1585
+
1586
+ .has-dates :where(.wp-block-latest-comments:not([style*="line-height"])),
1587
+ .has-excerpts :where(.wp-block-latest-comments:not([style*="line-height"])) {
1588
+ line-height: 1.5;
1589
+ }
1590
+
1537
1591
  .wp-block-latest-comments .wp-block-latest-comments {
1538
1592
  padding-left: 0;
1539
1593
  }
1540
1594
 
1541
1595
  .wp-block-latest-comments__comment {
1542
- line-height: 1.1;
1543
1596
  list-style: none;
1544
1597
  margin-bottom: 1em;
1545
1598
  }
@@ -1551,13 +1604,9 @@ ol.wp-block-latest-comments {
1551
1604
  .has-avatars .wp-block-latest-comments__comment .wp-block-latest-comments__comment-excerpt {
1552
1605
  margin-left: 3.25em;
1553
1606
  }
1554
- .has-dates .wp-block-latest-comments__comment, .has-excerpts .wp-block-latest-comments__comment {
1555
- line-height: 1.5;
1556
- }
1557
1607
 
1558
1608
  .wp-block-latest-comments__comment-excerpt p {
1559
1609
  font-size: 0.875em;
1560
- line-height: 1.8;
1561
1610
  margin: 0.36em 0 1.4em;
1562
1611
  }
1563
1612
 
@@ -1576,6 +1625,11 @@ ol.wp-block-latest-comments {
1576
1625
  width: 2.5em;
1577
1626
  }
1578
1627
 
1628
+ .wp-block-latest-comments[style*=font-size] a,
1629
+ .wp-block-latest-comments[class*=-font-size] a {
1630
+ font-size: inherit;
1631
+ }
1632
+
1579
1633
  .wp-block-latest-posts {
1580
1634
  box-sizing: border-box;
1581
1635
  }
@@ -2715,18 +2769,18 @@ p.has-background {
2715
2769
  box-sizing: border-box;
2716
2770
  overflow-wrap: break-word;
2717
2771
  }
2718
- .wp-block-quote.is-style-large:not(.is-style-plain), .wp-block-quote.is-large:not(.is-style-plain) {
2772
+ .wp-block-quote.is-style-large:where(:not(.is-style-plain)), .wp-block-quote.is-large:where(:not(.is-style-plain)) {
2719
2773
  margin-bottom: 1em;
2720
2774
  padding: 0 1em;
2721
2775
  }
2722
- .wp-block-quote.is-style-large:not(.is-style-plain) p, .wp-block-quote.is-large:not(.is-style-plain) p {
2776
+ .wp-block-quote.is-style-large:where(:not(.is-style-plain)) p, .wp-block-quote.is-large:where(:not(.is-style-plain)) p {
2723
2777
  font-size: 1.5em;
2724
2778
  font-style: italic;
2725
2779
  line-height: 1.6;
2726
2780
  }
2727
- .wp-block-quote.is-style-large:not(.is-style-plain) cite,
2728
- .wp-block-quote.is-style-large:not(.is-style-plain) footer, .wp-block-quote.is-large:not(.is-style-plain) cite,
2729
- .wp-block-quote.is-large:not(.is-style-plain) footer {
2781
+ .wp-block-quote.is-style-large:where(:not(.is-style-plain)) cite,
2782
+ .wp-block-quote.is-style-large:where(:not(.is-style-plain)) footer, .wp-block-quote.is-large:where(:not(.is-style-plain)) cite,
2783
+ .wp-block-quote.is-large:where(:not(.is-style-plain)) footer {
2730
2784
  font-size: 1.125em;
2731
2785
  text-align: right;
2732
2786
  }
@@ -16,7 +16,7 @@ export interface NestedHeadingData {
16
16
  * Takes a flat list of heading parameters and nests them based on each header's
17
17
  * immediate parent's level.
18
18
  *
19
- * @param headingList The flat list of headings to nest.
19
+ * @param headingList The flat list of headings to nest.
20
20
  *
21
21
  * @return The nested list of headings.
22
22
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "8.3.2",
3
+ "version": "8.4.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,34 +31,34 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.26.1",
35
- "@wordpress/api-fetch": "^6.23.1",
36
- "@wordpress/autop": "^3.26.1",
37
- "@wordpress/blob": "^3.26.1",
38
- "@wordpress/block-editor": "^11.3.2",
39
- "@wordpress/blocks": "^12.3.1",
40
- "@wordpress/components": "^23.3.1",
41
- "@wordpress/compose": "^6.3.1",
42
- "@wordpress/core-data": "^6.3.1",
43
- "@wordpress/data": "^8.3.1",
44
- "@wordpress/date": "^4.26.1",
45
- "@wordpress/deprecated": "^3.26.1",
46
- "@wordpress/dom": "^3.26.1",
47
- "@wordpress/element": "^5.3.1",
48
- "@wordpress/escape-html": "^2.26.1",
49
- "@wordpress/experiments": "^0.8.1",
50
- "@wordpress/hooks": "^3.26.1",
51
- "@wordpress/html-entities": "^3.26.1",
52
- "@wordpress/i18n": "^4.26.1",
53
- "@wordpress/icons": "^9.17.1",
54
- "@wordpress/keycodes": "^3.26.1",
55
- "@wordpress/notices": "^3.26.1",
56
- "@wordpress/primitives": "^3.24.1",
57
- "@wordpress/reusable-blocks": "^4.3.2",
58
- "@wordpress/rich-text": "^6.3.1",
59
- "@wordpress/server-side-render": "^4.3.1",
60
- "@wordpress/url": "^3.27.1",
61
- "@wordpress/viewport": "^5.3.1",
34
+ "@wordpress/a11y": "^3.27.0",
35
+ "@wordpress/api-fetch": "^6.24.0",
36
+ "@wordpress/autop": "^3.27.0",
37
+ "@wordpress/blob": "^3.27.0",
38
+ "@wordpress/block-editor": "^11.4.0",
39
+ "@wordpress/blocks": "^12.4.0",
40
+ "@wordpress/components": "^23.4.0",
41
+ "@wordpress/compose": "^6.4.0",
42
+ "@wordpress/core-data": "^6.4.0",
43
+ "@wordpress/data": "^8.4.0",
44
+ "@wordpress/date": "^4.27.0",
45
+ "@wordpress/deprecated": "^3.27.0",
46
+ "@wordpress/dom": "^3.27.0",
47
+ "@wordpress/element": "^5.4.0",
48
+ "@wordpress/escape-html": "^2.27.0",
49
+ "@wordpress/hooks": "^3.27.0",
50
+ "@wordpress/html-entities": "^3.27.0",
51
+ "@wordpress/i18n": "^4.27.0",
52
+ "@wordpress/icons": "^9.18.0",
53
+ "@wordpress/keycodes": "^3.27.0",
54
+ "@wordpress/notices": "^3.27.0",
55
+ "@wordpress/primitives": "^3.25.0",
56
+ "@wordpress/private-apis": "^0.9.0",
57
+ "@wordpress/reusable-blocks": "^4.4.0",
58
+ "@wordpress/rich-text": "^6.4.0",
59
+ "@wordpress/server-side-render": "^4.4.0",
60
+ "@wordpress/url": "^3.28.0",
61
+ "@wordpress/viewport": "^5.4.0",
62
62
  "change-case": "^4.1.2",
63
63
  "classnames": "^2.3.1",
64
64
  "colord": "^2.7.0",
@@ -77,5 +77,5 @@
77
77
  "publishConfig": {
78
78
  "access": "public"
79
79
  },
80
- "gitHead": "3eb2c536278d5a17f698b9c378fe3db746a89622"
80
+ "gitHead": "c25ff895413bad4354c55c0c2d732552618b0d56"
81
81
  }
@@ -16,67 +16,19 @@
16
16
  function render_block_core_avatar( $attributes, $content, $block ) {
17
17
  $size = isset( $attributes['size'] ) ? $attributes['size'] : 96;
18
18
  $wrapper_attributes = get_block_wrapper_attributes();
19
+ $border_attributes = get_block_core_avatar_border_attributes( $attributes );
19
20
 
20
- $image_styles = array();
21
+ // Class gets passed through `esc_attr` via `get_avatar`.
22
+ $image_classes = ! empty( $border_attributes['class'] )
23
+ ? "wp-block-avatar__image {$border_attributes['class']}"
24
+ : 'wp-block-avatar__image';
21
25
 
22
- // Add border width styles.
23
- $has_border_width = ! empty( $attributes['style']['border']['width'] );
24
-
25
- if ( $has_border_width ) {
26
- $border_width = $attributes['style']['border']['width'];
27
- $image_styles[] = sprintf( 'border-width: %s;', esc_attr( $border_width ) );
28
- }
29
-
30
- // Add border radius styles.
31
- $has_border_radius = ! empty( $attributes['style']['border']['radius'] );
32
-
33
- if ( $has_border_radius ) {
34
- $border_radius = $attributes['style']['border']['radius'];
35
-
36
- if ( is_array( $border_radius ) ) {
37
- // Apply styles for individual corner border radii.
38
- foreach ( $border_radius as $key => $value ) {
39
- if ( null !== $value ) {
40
- $name = _wp_to_kebab_case( $key );
41
- // Add shared styles for individual border radii.
42
- $border_style = sprintf(
43
- 'border-%s-radius: %s;',
44
- esc_attr( $name ),
45
- esc_attr( $value )
46
- );
47
- $image_styles[] = $border_style;
48
- }
49
- }
50
- } else {
51
- $border_style = sprintf( 'border-radius: %s;', esc_attr( $border_radius ) );
52
- $image_styles[] = $border_style;
53
- }
54
- }
55
-
56
- // Add border color styles.
57
- $has_border_color = ! empty( $attributes['style']['border']['color'] );
58
-
59
- if ( $has_border_color ) {
60
- $border_color = $attributes['style']['border']['color'];
61
- $image_styles[] = sprintf( 'border-color: %s;', esc_attr( $border_color ) );
62
- }
63
-
64
- // Add border style (solid, dashed, dotted ).
65
- $has_border_style = ! empty( $attributes['style']['border']['style'] );
66
-
67
- if ( $has_border_style ) {
68
- $border_style = $attributes['style']['border']['style'];
69
- $image_styles[] = sprintf( 'border-style: %s;', esc_attr( $border_style ) );
70
- }
71
-
72
- // Add border classes to the avatar image for both custom colors and palette colors.
73
- $image_classes = '';
74
- if ( $has_border_color || isset( $attributes['borderColor'] ) ) {
75
- $image_classes .= 'has-border-color';
76
- }
77
- if ( isset( $attributes['borderColor'] ) ) {
78
- $image_classes .= ' has-' . $attributes['borderColor'] . '-border-color';
79
- }
26
+ // Unlike class, `get_avatar` doesn't filter the styles via `esc_attr`.
27
+ // The style engine does pass the border styles through
28
+ // `safecss_filter_attr` however.
29
+ $image_styles = ! empty( $border_attributes['style'] )
30
+ ? sprintf( ' style="%s"', esc_attr( $border_attributes['style'] ) )
31
+ : '';
80
32
 
81
33
  if ( ! isset( $block->context['commentId'] ) ) {
82
34
  $author_id = isset( $attributes['userId'] ) ? $attributes['userId'] : get_post_field( 'post_author', $block->context['postId'] );
@@ -89,8 +41,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
89
41
  '',
90
42
  $alt,
91
43
  array(
92
- 'extra_attr' => isset( $image_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $image_styles ) ) ) : '',
93
- 'class' => "wp-block-avatar__image $image_classes ",
44
+ 'extra_attr' => $image_styles,
45
+ 'class' => $image_classes,
94
46
  )
95
47
  );
96
48
  if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
@@ -116,8 +68,8 @@ function render_block_core_avatar( $attributes, $content, $block ) {
116
68
  '',
117
69
  $alt,
118
70
  array(
119
- 'extra_attr' => isset( $image_styles ) ? sprintf( ' style="%s"', safecss_filter_attr( implode( ' ', $image_styles ) ) ) : '',
120
- 'class' => "wp-block-avatar__image $image_classes",
71
+ 'extra_attr' => $image_styles,
72
+ 'class' => $image_classes,
121
73
  )
122
74
  );
123
75
  if ( isset( $attributes['isLink'] ) && $attributes['isLink'] && isset( $comment->comment_author_url ) && '' !== $comment->comment_author_url ) {
@@ -132,6 +84,58 @@ function render_block_core_avatar( $attributes, $content, $block ) {
132
84
  return sprintf( '<div %1s>%2s</div>', $wrapper_attributes, $avatar_block );
133
85
  }
134
86
 
87
+ /**
88
+ * Generates class names and styles to apply the border support styles for
89
+ * the Avatar block.
90
+ *
91
+ * @param array $attributes The block attributes.
92
+ * @return array The border-related classnames and styles for the block.
93
+ */
94
+ function get_block_core_avatar_border_attributes( $attributes ) {
95
+ $border_styles = array();
96
+ $sides = array( 'top', 'right', 'bottom', 'left' );
97
+
98
+ // Border radius.
99
+ if ( isset( $attributes['style']['border']['radius'] ) ) {
100
+ $border_styles['radius'] = $attributes['style']['border']['radius'];
101
+ }
102
+
103
+ // Border style.
104
+ if ( isset( $attributes['style']['border']['style'] ) ) {
105
+ $border_styles['style'] = $attributes['style']['border']['style'];
106
+ }
107
+
108
+ // Border width.
109
+ if ( isset( $attributes['style']['border']['width'] ) ) {
110
+ $border_styles['width'] = $attributes['style']['border']['width'];
111
+ }
112
+
113
+ // Border color.
114
+ $preset_color = array_key_exists( 'borderColor', $attributes ) ? "var:preset|color|{$attributes['borderColor']}" : null;
115
+ $custom_color = _wp_array_get( $attributes, array( 'style', 'border', 'color' ), null );
116
+ $border_styles['color'] = $preset_color ? $preset_color : $custom_color;
117
+
118
+ // Individual border styles e.g. top, left etc.
119
+ foreach ( $sides as $side ) {
120
+ $border = _wp_array_get( $attributes, array( 'style', 'border', $side ), null );
121
+ $border_styles[ $side ] = array(
122
+ 'color' => isset( $border['color'] ) ? $border['color'] : null,
123
+ 'style' => isset( $border['style'] ) ? $border['style'] : null,
124
+ 'width' => isset( $border['width'] ) ? $border['width'] : null,
125
+ );
126
+ }
127
+
128
+ $styles = wp_style_engine_get_styles( array( 'border' => $border_styles ) );
129
+ $attributes = array();
130
+ if ( ! empty( $styles['classnames'] ) ) {
131
+ $attributes['class'] = $styles['classnames'];
132
+ }
133
+ if ( ! empty( $styles['css'] ) ) {
134
+ $attributes['style'] = $styles['css'];
135
+ }
136
+ return $attributes;
137
+ }
138
+
135
139
  /**
136
140
  * Registers the `core/avatar` block on the server.
137
141
  */
@@ -1,6 +1,9 @@
1
1
  .wp-block-avatar {
2
2
  // This block has customizable padding, border-box makes that more predictable.
3
3
  box-sizing: border-box;
4
+ img {
5
+ box-sizing: border-box;
6
+ }
4
7
 
5
8
  &.aligncenter {
6
9
  text-align: center;
@@ -16,30 +16,35 @@
16
16
  "type": "string",
17
17
  "source": "attribute",
18
18
  "selector": "a",
19
- "attribute": "href"
19
+ "attribute": "href",
20
+ "__experimentalRole": "content"
20
21
  },
21
22
  "title": {
22
23
  "type": "string",
23
24
  "source": "attribute",
24
25
  "selector": "a",
25
- "attribute": "title"
26
+ "attribute": "title",
27
+ "__experimentalRole": "content"
26
28
  },
27
29
  "text": {
28
30
  "type": "string",
29
31
  "source": "html",
30
- "selector": "a"
32
+ "selector": "a",
33
+ "__experimentalRole": "content"
31
34
  },
32
35
  "linkTarget": {
33
36
  "type": "string",
34
37
  "source": "attribute",
35
38
  "selector": "a",
36
- "attribute": "target"
39
+ "attribute": "target",
40
+ "__experimentalRole": "content"
37
41
  },
38
42
  "rel": {
39
43
  "type": "string",
40
44
  "source": "attribute",
41
45
  "selector": "a",
42
- "attribute": "rel"
46
+ "attribute": "rel",
47
+ "__experimentalRole": "content"
43
48
  },
44
49
  "placeholder": {
45
50
  "type": "string"
@@ -92,10 +97,16 @@
92
97
  }
93
98
  },
94
99
  "__experimentalBorder": {
100
+ "color": true,
95
101
  "radius": true,
102
+ "style": true,
103
+ "width": true,
96
104
  "__experimentalSkipSerialization": true,
97
105
  "__experimentalDefaultControls": {
98
- "radius": true
106
+ "color": true,
107
+ "radius": true,
108
+ "style": true,
109
+ "width": true
99
110
  }
100
111
  },
101
112
  "__experimentalSelector": ".wp-block-button .wp-block-button__link"
@@ -32,6 +32,7 @@ import { displayShortcut, isKeyboardEvent } from '@wordpress/keycodes';
32
32
  import { link, linkOff } from '@wordpress/icons';
33
33
  import { createBlock } from '@wordpress/blocks';
34
34
  import { useMergeRefs } from '@wordpress/compose';
35
+ import { prependHTTP } from '@wordpress/url';
35
36
 
36
37
  const NEW_TAB_REL = 'noreferrer noopener';
37
38
 
@@ -240,7 +241,7 @@ function ButtonEdit( props ) {
240
241
  url: newURL = '',
241
242
  opensInNewTab: newOpensInNewTab,
242
243
  } ) => {
243
- setAttributes( { url: newURL } );
244
+ setAttributes( { url: prependHTTP( newURL ) } );
244
245
 
245
246
  if ( opensInNewTab !== newOpensInNewTab ) {
246
247
  onToggleOpenInNewTab( newOpensInNewTab );
@@ -79,3 +79,39 @@ div[data-type="core/button"] {
79
79
  .editor-styles-wrapper .wp-block-button[style*="text-decoration"] .wp-block-button__link {
80
80
  text-decoration: inherit;
81
81
  }
82
+
83
+ .editor-styles-wrapper .wp-block-button .wp-block-button__link {
84
+ // The following styles ensure a default border is applied when the user selects only a border color or style in the editor,
85
+ // but no width. They override the `border-width: 0;` applied by core's theme.json via the Elements API button.
86
+ &:where(.has-border-color) {
87
+ border-width: initial;
88
+ }
89
+ &:where([style*="border-top-color"]) {
90
+ border-top-width: initial;
91
+ }
92
+ &:where([style*="border-right-color"]) {
93
+ border-right-width: initial;
94
+ }
95
+ &:where([style*="border-bottom-color"]) {
96
+ border-bottom-width: initial;
97
+ }
98
+ &:where([style*="border-left-color"]) {
99
+ border-left-width: initial;
100
+ }
101
+
102
+ &:where([style*="border-style"]) {
103
+ border-width: initial;
104
+ }
105
+ &:where([style*="border-top-style"]) {
106
+ border-top-width: initial;
107
+ }
108
+ &:where([style*="border-right-style"]) {
109
+ border-right-width: initial;
110
+ }
111
+ &:where([style*="border-bottom-style"]) {
112
+ border-bottom-width: initial;
113
+ }
114
+ &:where([style*="border-left-style"]) {
115
+ border-left-width: initial;
116
+ }
117
+ }
@@ -92,7 +92,6 @@ $blocks-block__margin: 0.5em;
92
92
  border-radius: 0;
93
93
  }
94
94
 
95
-
96
95
  // the first selector is required for old buttons markup
97
96
  .wp-block-button.no-border-radius,
98
97
  .wp-block-button__link.no-border-radius {
@@ -116,3 +115,40 @@ $blocks-block__margin: 0.5em;
116
115
  // background-image is required to overwrite a gradient background
117
116
  background-image: none;
118
117
  }
118
+
119
+ .wp-block-button .wp-block-button__link {
120
+ // The following styles ensure a default border is applied when the user
121
+ // selects only a border color or style. This overcomes the zero border
122
+ // width applied by core's theme.json via the elements API.
123
+ &:where(.has-border-color) {
124
+ border-width: initial;
125
+ }
126
+ &:where([style*="border-top-color"]) {
127
+ border-top-width: initial;
128
+ }
129
+ &:where([style*="border-right-color"]) {
130
+ border-right-width: initial;
131
+ }
132
+ &:where([style*="border-bottom-color"]) {
133
+ border-bottom-width: initial;
134
+ }
135
+ &:where([style*="border-left-color"]) {
136
+ border-left-width: initial;
137
+ }
138
+
139
+ &:where([style*="border-style"]) {
140
+ border-width: initial;
141
+ }
142
+ &:where([style*="border-top-style"]) {
143
+ border-top-width: initial;
144
+ }
145
+ &:where([style*="border-right-style"]) {
146
+ border-right-width: initial;
147
+ }
148
+ &:where([style*="border-bottom-style"]) {
149
+ border-bottom-width: initial;
150
+ }
151
+ &:where([style*="border-left-style"]) {
152
+ border-left-width: initial;
153
+ }
154
+ }
package/src/classic.scss CHANGED
@@ -13,3 +13,8 @@
13
13
 
14
14
  font-size: 1.125em;
15
15
  }
16
+
17
+ .wp-block-file__button {
18
+ background: #32373c;
19
+ color: $white;
20
+ }
@@ -116,7 +116,10 @@ function CoverEdit( {
116
116
  // we define the url and background type
117
117
  // depending on the value of the useFeaturedImage flag
118
118
  // to preview in edit the dynamic featured image
119
- const url = useFeaturedImage ? mediaUrl : attributes.url;
119
+ const url = useFeaturedImage
120
+ ? mediaUrl
121
+ : // Ensure the url is not malformed due to sanitization through `wp_kses`.
122
+ attributes.url?.replaceAll( '&amp;', '&' );
120
123
  const backgroundType = useFeaturedImage
121
124
  ? IMAGE_BACKGROUND_TYPE
122
125
  : attributes.backgroundType;
package/src/editor.scss CHANGED
@@ -93,3 +93,8 @@
93
93
  * These are only output in the editor, but styles here are NOT prefixed .editor-styles-wrapper.
94
94
  * This allows us to create normalization styles that are easily overridden by editor styles.
95
95
  */
96
+
97
+ // Remove the browser default border for iframe in Custom HTML block, Embed block, etc.
98
+ .editor-styles-wrapper iframe:not([frameborder]) {
99
+ border: 0;
100
+ }
@@ -56,7 +56,16 @@
56
56
  },
57
57
  "supports": {
58
58
  "anchor": true,
59
- "align": true
59
+ "align": true,
60
+ "color": {
61
+ "gradients": true,
62
+ "link": true,
63
+ "text": false,
64
+ "__experimentalDefaultControls": {
65
+ "background": true,
66
+ "link": true
67
+ }
68
+ }
60
69
  },
61
70
  "viewScript": "file:./view.min.js",
62
71
  "editorStyle": "wp-block-file-editor",
@@ -27,6 +27,7 @@
27
27
  :where(.wp-block-file__button) {
28
28
  border-radius: 2em;
29
29
  padding: 0.5em 1em;
30
+ display: inline-block;
30
31
 
31
32
  &:is(a) {
32
33
 
@@ -141,6 +141,7 @@ figure.wp-block-image:not(.wp-block) {
141
141
  // smoother UX.
142
142
  .reactEasyCrop_Container .reactEasyCrop_Image {
143
143
  border: none;
144
+ border-radius: 0; // Prevent's theme.json radius bleeding into cropper.
144
145
  }
145
146
  }
146
147