@wordpress/block-library 7.17.0 → 7.18.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 (233) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/audio/edit.js +44 -4
  3. package/build/audio/edit.js.map +1 -1
  4. package/build/button/edit.js +1 -1
  5. package/build/button/edit.js.map +1 -1
  6. package/build/buttons/edit.native.js +1 -1
  7. package/build/buttons/edit.native.js.map +1 -1
  8. package/build/comment-template/index.js +6 -2
  9. package/build/comment-template/index.js.map +1 -1
  10. package/build/cover/edit/inspector-controls.js +3 -7
  11. package/build/cover/edit/inspector-controls.js.map +1 -1
  12. package/build/embed/deprecated.js +43 -4
  13. package/build/embed/deprecated.js.map +1 -1
  14. package/build/file/deprecated.js +108 -4
  15. package/build/file/deprecated.js.map +1 -1
  16. package/build/file/transforms.js +3 -9
  17. package/build/file/transforms.js.map +1 -1
  18. package/build/gallery/deprecated.js +148 -23
  19. package/build/gallery/deprecated.js.map +1 -1
  20. package/build/gallery/gallery.js +3 -2
  21. package/build/gallery/gallery.js.map +1 -1
  22. package/build/gallery/use-image-sizes.js +2 -1
  23. package/build/gallery/use-image-sizes.js.map +1 -1
  24. package/build/gallery/v1/edit.js +2 -1
  25. package/build/gallery/v1/edit.js.map +1 -1
  26. package/build/group/edit.js +7 -3
  27. package/build/group/edit.js.map +1 -1
  28. package/build/image/edit.native.js +1 -1
  29. package/build/image/edit.native.js.map +1 -1
  30. package/build/image/image.js +6 -9
  31. package/build/image/image.js.map +1 -1
  32. package/build/latest-posts/edit.js +1 -1
  33. package/build/latest-posts/edit.js.map +1 -1
  34. package/build/list/utils.js +4 -8
  35. package/build/list/utils.js.map +1 -1
  36. package/build/list-item/hooks/use-outdent-list-item.js +5 -7
  37. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  38. package/build/navigation/edit/index.js +12 -11
  39. package/build/navigation/edit/index.js.map +1 -1
  40. package/build/navigation/edit/unsaved-inner-blocks.js +3 -1
  41. package/build/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  42. package/build/navigation-link/edit.js +4 -2
  43. package/build/navigation-link/edit.js.map +1 -1
  44. package/build/navigation-submenu/edit.js +4 -4
  45. package/build/navigation-submenu/edit.js.map +1 -1
  46. package/build/page-list/edit.js +29 -10
  47. package/build/page-list/edit.js.map +1 -1
  48. package/build/post-comments-count/index.js +4 -0
  49. package/build/post-comments-count/index.js.map +1 -1
  50. package/build/post-comments-form/index.js +4 -0
  51. package/build/post-comments-form/index.js.map +1 -1
  52. package/build/post-comments-link/index.js +4 -0
  53. package/build/post-comments-link/index.js.map +1 -1
  54. package/build/post-content/edit.js +14 -6
  55. package/build/post-content/edit.js.map +1 -1
  56. package/build/pullquote/deprecated.js +6 -6
  57. package/build/pullquote/deprecated.js.map +1 -1
  58. package/build/search/edit.js +1 -3
  59. package/build/search/edit.js.map +1 -1
  60. package/build/site-logo/edit.js +1 -1
  61. package/build/site-logo/edit.js.map +1 -1
  62. package/build/site-tagline/edit.js +21 -9
  63. package/build/site-tagline/edit.js.map +1 -1
  64. package/build/site-title/edit/index.js +20 -8
  65. package/build/site-title/edit/index.js.map +1 -1
  66. package/build/social-link/edit.js +11 -2
  67. package/build/social-link/edit.js.map +1 -1
  68. package/build/social-link/index.js +3 -0
  69. package/build/social-link/index.js.map +1 -1
  70. package/build/spacer/controls.js +3 -7
  71. package/build/spacer/controls.js.map +1 -1
  72. package/build/table/deprecated.js +282 -27
  73. package/build/table/deprecated.js.map +1 -1
  74. package/build/table/state.js +1 -1
  75. package/build/table/state.js.map +1 -1
  76. package/build/utils/clean-empty-object.js +5 -4
  77. package/build/utils/clean-empty-object.js.map +1 -1
  78. package/build/video/deprecated.js +159 -0
  79. package/build/video/deprecated.js.map +1 -0
  80. package/build/video/edit.js +41 -5
  81. package/build/video/edit.js.map +1 -1
  82. package/build/video/index.js +3 -0
  83. package/build/video/index.js.map +1 -1
  84. package/build/video/tracks-editor.js +3 -28
  85. package/build/video/tracks-editor.js.map +1 -1
  86. package/build-module/audio/edit.js +46 -7
  87. package/build-module/audio/edit.js.map +1 -1
  88. package/build-module/button/edit.js +1 -1
  89. package/build-module/button/edit.js.map +1 -1
  90. package/build-module/buttons/edit.native.js +1 -1
  91. package/build-module/buttons/edit.native.js.map +1 -1
  92. package/build-module/comment-template/index.js +6 -2
  93. package/build-module/comment-template/index.js.map +1 -1
  94. package/build-module/cover/edit/inspector-controls.js +4 -8
  95. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  96. package/build-module/embed/deprecated.js +44 -5
  97. package/build-module/embed/deprecated.js.map +1 -1
  98. package/build-module/file/deprecated.js +108 -4
  99. package/build-module/file/deprecated.js.map +1 -1
  100. package/build-module/file/transforms.js +3 -8
  101. package/build-module/file/transforms.js.map +1 -1
  102. package/build-module/gallery/deprecated.js +147 -25
  103. package/build-module/gallery/deprecated.js.map +1 -1
  104. package/build-module/gallery/gallery.js +3 -2
  105. package/build-module/gallery/gallery.js.map +1 -1
  106. package/build-module/gallery/use-image-sizes.js +3 -2
  107. package/build-module/gallery/use-image-sizes.js.map +1 -1
  108. package/build-module/gallery/v1/edit.js +3 -2
  109. package/build-module/gallery/v1/edit.js.map +1 -1
  110. package/build-module/group/edit.js +7 -3
  111. package/build-module/group/edit.js.map +1 -1
  112. package/build-module/image/edit.native.js +1 -1
  113. package/build-module/image/edit.native.js.map +1 -1
  114. package/build-module/image/image.js +8 -11
  115. package/build-module/image/image.js.map +1 -1
  116. package/build-module/latest-posts/edit.js +2 -2
  117. package/build-module/latest-posts/edit.js.map +1 -1
  118. package/build-module/list/utils.js +5 -9
  119. package/build-module/list/utils.js.map +1 -1
  120. package/build-module/list-item/hooks/use-outdent-list-item.js +5 -6
  121. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  122. package/build-module/navigation/edit/index.js +12 -11
  123. package/build-module/navigation/edit/index.js.map +1 -1
  124. package/build-module/navigation/edit/unsaved-inner-blocks.js +3 -1
  125. package/build-module/navigation/edit/unsaved-inner-blocks.js.map +1 -1
  126. package/build-module/navigation-link/edit.js +4 -3
  127. package/build-module/navigation-link/edit.js.map +1 -1
  128. package/build-module/navigation-submenu/edit.js +4 -4
  129. package/build-module/navigation-submenu/edit.js.map +1 -1
  130. package/build-module/page-list/edit.js +29 -10
  131. package/build-module/page-list/edit.js.map +1 -1
  132. package/build-module/post-comments-count/index.js +4 -0
  133. package/build-module/post-comments-count/index.js.map +1 -1
  134. package/build-module/post-comments-form/index.js +4 -0
  135. package/build-module/post-comments-form/index.js.map +1 -1
  136. package/build-module/post-comments-link/index.js +4 -0
  137. package/build-module/post-comments-link/index.js.map +1 -1
  138. package/build-module/post-content/edit.js +14 -6
  139. package/build-module/post-content/edit.js.map +1 -1
  140. package/build-module/pullquote/deprecated.js +7 -7
  141. package/build-module/pullquote/deprecated.js.map +1 -1
  142. package/build-module/search/edit.js +1 -3
  143. package/build-module/search/edit.js.map +1 -1
  144. package/build-module/site-logo/edit.js +2 -2
  145. package/build-module/site-logo/edit.js.map +1 -1
  146. package/build-module/site-tagline/edit.js +23 -11
  147. package/build-module/site-tagline/edit.js.map +1 -1
  148. package/build-module/site-title/edit/index.js +22 -10
  149. package/build-module/site-title/edit/index.js.map +1 -1
  150. package/build-module/social-link/edit.js +11 -2
  151. package/build-module/social-link/edit.js.map +1 -1
  152. package/build-module/social-link/index.js +3 -0
  153. package/build-module/social-link/index.js.map +1 -1
  154. package/build-module/spacer/controls.js +4 -8
  155. package/build-module/spacer/controls.js.map +1 -1
  156. package/build-module/table/deprecated.js +282 -27
  157. package/build-module/table/deprecated.js.map +1 -1
  158. package/build-module/table/state.js +1 -1
  159. package/build-module/table/state.js.map +1 -1
  160. package/build-module/utils/clean-empty-object.js +5 -5
  161. package/build-module/utils/clean-empty-object.js.map +1 -1
  162. package/build-module/video/deprecated.js +147 -0
  163. package/build-module/video/deprecated.js.map +1 -0
  164. package/build-module/video/edit.js +45 -9
  165. package/build-module/video/edit.js.map +1 -1
  166. package/build-module/video/index.js +2 -0
  167. package/build-module/video/index.js.map +1 -1
  168. package/build-module/video/tracks-editor.js +4 -29
  169. package/build-module/video/tracks-editor.js.map +1 -1
  170. package/build-style/button/style-rtl.css +1 -0
  171. package/build-style/button/style.css +1 -0
  172. package/build-style/comment-template/style-rtl.css +1 -0
  173. package/build-style/comment-template/style.css +1 -0
  174. package/build-style/editor-rtl.css +4 -4
  175. package/build-style/editor.css +4 -4
  176. package/build-style/navigation/editor-rtl.css +4 -4
  177. package/build-style/navigation/editor.css +4 -4
  178. package/build-style/navigation/style-rtl.css +3 -1
  179. package/build-style/navigation/style.css +3 -1
  180. package/build-style/post-comments-form/style-rtl.css +3 -0
  181. package/build-style/post-comments-form/style.css +3 -0
  182. package/build-style/style-rtl.css +8 -1
  183. package/build-style/style.css +8 -1
  184. package/package.json +29 -28
  185. package/src/audio/edit.js +79 -24
  186. package/src/button/edit.js +1 -1
  187. package/src/button/style.scss +2 -0
  188. package/src/buttons/edit.native.js +1 -1
  189. package/src/comment-template/block.json +6 -2
  190. package/src/comment-template/style.scss +2 -0
  191. package/src/cover/edit/inspector-controls.js +11 -13
  192. package/src/embed/deprecated.js +53 -26
  193. package/src/file/deprecated.js +130 -2
  194. package/src/file/transforms.js +3 -8
  195. package/src/gallery/deprecated.js +129 -4
  196. package/src/gallery/gallery.js +2 -0
  197. package/src/gallery/index.php +19 -10
  198. package/src/gallery/use-image-sizes.js +3 -2
  199. package/src/gallery/v1/edit.js +3 -2
  200. package/src/group/edit.js +10 -2
  201. package/src/image/edit.native.js +1 -1
  202. package/src/image/image.js +22 -10
  203. package/src/latest-posts/edit.js +2 -2
  204. package/src/list/utils.js +3 -11
  205. package/src/list-item/hooks/use-outdent-list-item.js +3 -6
  206. package/src/navigation/edit/index.js +13 -15
  207. package/src/navigation/edit/unsaved-inner-blocks.js +9 -2
  208. package/src/navigation/editor.scss +4 -4
  209. package/src/navigation/style.scss +3 -1
  210. package/src/navigation-link/edit.js +5 -4
  211. package/src/navigation-submenu/edit.js +7 -5
  212. package/src/page-list/edit.js +36 -22
  213. package/src/post-comments-count/block.json +4 -0
  214. package/src/post-comments-form/block.json +4 -0
  215. package/src/post-comments-form/style.scss +3 -0
  216. package/src/post-comments-link/block.json +4 -0
  217. package/src/post-content/edit.js +8 -4
  218. package/src/pullquote/deprecated.js +7 -7
  219. package/src/search/edit.js +1 -1
  220. package/src/site-logo/edit.js +2 -2
  221. package/src/site-tagline/edit.js +25 -18
  222. package/src/site-title/edit/index.js +26 -12
  223. package/src/social-link/block.json +3 -0
  224. package/src/social-link/edit.js +8 -1
  225. package/src/social-link/index.php +11 -7
  226. package/src/spacer/controls.js +10 -12
  227. package/src/table/deprecated.js +587 -348
  228. package/src/table/state.js +1 -1
  229. package/src/utils/clean-empty-object.js +5 -6
  230. package/src/video/deprecated.js +57 -0
  231. package/src/video/edit.js +71 -23
  232. package/src/video/index.js +2 -0
  233. package/src/video/tracks-editor.js +12 -28
@@ -256,10 +256,6 @@
256
256
  color: #1e1e1e;
257
257
  }
258
258
 
259
- .wp-block-navigation-placeholder .components-spinner {
260
- margin-top: 0;
261
- }
262
-
263
259
  .wp-block-navigation-placeholder__preview {
264
260
  display: flex;
265
261
  align-items: center;
@@ -496,6 +492,10 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
496
492
  padding: 8px 12px;
497
493
  }
498
494
 
495
+ .wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator {
496
+ margin-top: 0;
497
+ }
498
+
499
499
  @keyframes fadeouthalf {
500
500
  0% {
501
501
  opacity: 1;
@@ -256,10 +256,6 @@
256
256
  color: #1e1e1e;
257
257
  }
258
258
 
259
- .wp-block-navigation-placeholder .components-spinner {
260
- margin-top: 0;
261
- }
262
-
263
259
  .wp-block-navigation-placeholder__preview {
264
260
  display: flex;
265
261
  align-items: center;
@@ -496,6 +492,10 @@ body.editor-styles-wrapper .wp-block-navigation__responsive-container.is-menu-op
496
492
  padding: 8px 12px;
497
493
  }
498
494
 
495
+ .wp-block-navigation .wp-block-navigation__uncontrolled-inner-blocks-loading-indicator {
496
+ margin-top: 0;
497
+ }
498
+
499
499
  @keyframes fadeouthalf {
500
500
  0% {
501
501
  opacity: 1;
@@ -311,7 +311,9 @@ button.wp-block-navigation-item__content {
311
311
  }
312
312
 
313
313
  :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),
314
- :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)) {
314
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),
315
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),
316
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content) {
315
317
  padding: 0.5em 1em;
316
318
  }
317
319
 
@@ -311,7 +311,9 @@ button.wp-block-navigation-item__content {
311
311
  }
312
312
 
313
313
  :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),
314
- :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)) {
314
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),
315
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),
316
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content) {
315
317
  padding: 0.5em 1em;
316
318
  }
317
319
 
@@ -74,6 +74,9 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
+ .wp-block-post-comments-form {
78
+ box-sizing: border-box;
79
+ }
77
80
  .wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) {
78
81
  font-weight: inherit;
79
82
  }
@@ -74,6 +74,9 @@
74
74
  /**
75
75
  * Reset the WP Admin page styles for Gutenberg-like pages.
76
76
  */
77
+ .wp-block-post-comments-form {
78
+ box-sizing: border-box;
79
+ }
77
80
  .wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) {
78
81
  font-weight: inherit;
79
82
  }
@@ -184,6 +184,7 @@
184
184
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
185
185
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
186
186
  background-color: transparent;
187
+ background-image: none;
187
188
  }
188
189
 
189
190
  .wp-block-buttons {
@@ -518,6 +519,7 @@
518
519
  }
519
520
 
520
521
  .wp-block-comment-template {
522
+ box-sizing: border-box;
521
523
  margin-bottom: 0;
522
524
  max-width: 100%;
523
525
  list-style: none;
@@ -1981,7 +1983,9 @@ button.wp-block-navigation-item__content {
1981
1983
  }
1982
1984
 
1983
1985
  :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),
1984
- :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)) {
1986
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),
1987
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),
1988
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content) {
1985
1989
  padding: 0.5em 1em;
1986
1990
  }
1987
1991
 
@@ -2330,6 +2334,9 @@ p.has-background {
2330
2334
  margin: 0;
2331
2335
  }
2332
2336
 
2337
+ .wp-block-post-comments-form {
2338
+ box-sizing: border-box;
2339
+ }
2333
2340
  .wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) {
2334
2341
  font-weight: inherit;
2335
2342
  }
@@ -185,6 +185,7 @@
185
185
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
186
186
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
187
187
  background-color: transparent;
188
+ background-image: none;
188
189
  }
189
190
 
190
191
  .wp-block-buttons {
@@ -523,6 +524,7 @@
523
524
  }
524
525
 
525
526
  .wp-block-comment-template {
527
+ box-sizing: border-box;
526
528
  margin-bottom: 0;
527
529
  max-width: 100%;
528
530
  list-style: none;
@@ -2009,7 +2011,9 @@ button.wp-block-navigation-item__content {
2009
2011
  }
2010
2012
 
2011
2013
  :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-item a:not(.wp-element-button)),
2012
- :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)) {
2014
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu a:not(.wp-element-button)),
2015
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-navigation-submenu button.wp-block-navigation-item__content),
2016
+ :where(.wp-block-navigation .wp-block-navigation__submenu-container .wp-block-pages-list__item button.wp-block-navigation-item__content) {
2013
2017
  padding: 0.5em 1em;
2014
2018
  }
2015
2019
 
@@ -2358,6 +2362,9 @@ p.has-background {
2358
2362
  margin: 0;
2359
2363
  }
2360
2364
 
2365
+ .wp-block-post-comments-form {
2366
+ box-sizing: border-box;
2367
+ }
2361
2368
  .wp-block-post-comments-form[style*=font-weight] :where(.comment-reply-title) {
2362
2369
  font-weight: inherit;
2363
2370
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "7.17.0",
3
+ "version": "7.18.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,36 @@
31
31
  ],
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.16.0",
34
- "@wordpress/a11y": "^3.20.0",
35
- "@wordpress/api-fetch": "^6.17.0",
36
- "@wordpress/autop": "^3.20.0",
37
- "@wordpress/blob": "^3.20.0",
38
- "@wordpress/block-editor": "^10.3.0",
39
- "@wordpress/blocks": "^11.19.0",
40
- "@wordpress/components": "^21.3.0",
41
- "@wordpress/compose": "^5.18.0",
42
- "@wordpress/core-data": "^5.3.0",
43
- "@wordpress/data": "^7.4.0",
44
- "@wordpress/date": "^4.20.0",
45
- "@wordpress/deprecated": "^3.20.0",
46
- "@wordpress/dom": "^3.20.0",
47
- "@wordpress/element": "^4.18.0",
48
- "@wordpress/hooks": "^3.20.0",
49
- "@wordpress/html-entities": "^3.20.0",
50
- "@wordpress/i18n": "^4.20.0",
51
- "@wordpress/icons": "^9.11.0",
52
- "@wordpress/keycodes": "^3.20.0",
53
- "@wordpress/notices": "^3.20.0",
54
- "@wordpress/primitives": "^3.18.0",
55
- "@wordpress/reusable-blocks": "^3.18.0",
56
- "@wordpress/rich-text": "^5.18.0",
57
- "@wordpress/server-side-render": "^3.18.0",
58
- "@wordpress/url": "^3.21.0",
59
- "@wordpress/viewport": "^4.18.0",
34
+ "@wordpress/a11y": "^3.21.0",
35
+ "@wordpress/api-fetch": "^6.18.0",
36
+ "@wordpress/autop": "^3.21.0",
37
+ "@wordpress/blob": "^3.21.0",
38
+ "@wordpress/block-editor": "^10.4.0",
39
+ "@wordpress/blocks": "^11.20.0",
40
+ "@wordpress/components": "^22.0.0",
41
+ "@wordpress/compose": "^5.19.0",
42
+ "@wordpress/core-data": "^5.4.0",
43
+ "@wordpress/data": "^7.5.0",
44
+ "@wordpress/date": "^4.21.0",
45
+ "@wordpress/deprecated": "^3.21.0",
46
+ "@wordpress/dom": "^3.21.0",
47
+ "@wordpress/element": "^4.19.0",
48
+ "@wordpress/hooks": "^3.21.0",
49
+ "@wordpress/html-entities": "^3.21.0",
50
+ "@wordpress/i18n": "^4.21.0",
51
+ "@wordpress/icons": "^9.12.0",
52
+ "@wordpress/keycodes": "^3.21.0",
53
+ "@wordpress/notices": "^3.21.0",
54
+ "@wordpress/primitives": "^3.19.0",
55
+ "@wordpress/reusable-blocks": "^3.19.0",
56
+ "@wordpress/rich-text": "^5.19.0",
57
+ "@wordpress/server-side-render": "^3.19.0",
58
+ "@wordpress/url": "^3.22.0",
59
+ "@wordpress/viewport": "^4.19.0",
60
60
  "change-case": "^4.1.2",
61
61
  "classnames": "^2.3.1",
62
62
  "colord": "^2.7.0",
63
+ "escape-html": "^1.0.3",
63
64
  "fast-average-color": "^9.1.1",
64
65
  "lodash": "^4.17.21",
65
66
  "memize": "^1.1.0",
@@ -73,5 +74,5 @@
73
74
  "publishConfig": {
74
75
  "access": "public"
75
76
  },
76
- "gitHead": "a2ff0e6471c88436dad0287beb88d1729aa6f5dd"
77
+ "gitHead": "511f4cc1f0138641bc4394bc1cf36e833109c791"
77
78
  }
package/src/audio/edit.js CHANGED
@@ -13,6 +13,7 @@ import {
13
13
  SelectControl,
14
14
  Spinner,
15
15
  ToggleControl,
16
+ ToolbarButton,
16
17
  } from '@wordpress/components';
17
18
  import {
18
19
  BlockControls,
@@ -25,12 +26,13 @@ import {
25
26
  store as blockEditorStore,
26
27
  __experimentalGetElementClassName,
27
28
  } from '@wordpress/block-editor';
28
- import { useEffect } from '@wordpress/element';
29
+ import { useEffect, useState, useCallback } from '@wordpress/element';
29
30
  import { __, _x } from '@wordpress/i18n';
30
31
  import { useDispatch, useSelect } from '@wordpress/data';
31
- import { audio as icon } from '@wordpress/icons';
32
+ import { audio as icon, caption as captionIcon } from '@wordpress/icons';
32
33
  import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
33
34
  import { store as noticesStore } from '@wordpress/notices';
35
+ import { usePrevious } from '@wordpress/compose';
34
36
 
35
37
  /**
36
38
  * Internal dependencies
@@ -48,6 +50,8 @@ function AudioEdit( {
48
50
  insertBlocksAfter,
49
51
  } ) {
50
52
  const { id, autoplay, caption, loop, preload, src } = attributes;
53
+ const prevCaption = usePrevious( caption );
54
+ const [ showCaption, setShowCaption ] = useState( !! caption );
51
55
  const isTemporaryAudio = ! id && isBlobURL( src );
52
56
  const mediaUpload = useSelect( ( select ) => {
53
57
  const { getSettings } = select( blockEditorStore );
@@ -69,6 +73,30 @@ function AudioEdit( {
69
73
  }
70
74
  }, [] );
71
75
 
76
+ // We need to show the caption when changes come from
77
+ // history navigation(undo/redo).
78
+ useEffect( () => {
79
+ if ( caption && ! prevCaption ) {
80
+ setShowCaption( true );
81
+ }
82
+ }, [ caption, prevCaption ] );
83
+
84
+ // Focus the caption when we click to add one.
85
+ const captionRef = useCallback(
86
+ ( node ) => {
87
+ if ( node && ! caption ) {
88
+ node.focus();
89
+ }
90
+ },
91
+ [ caption ]
92
+ );
93
+
94
+ useEffect( () => {
95
+ if ( ! isSelected && ! caption ) {
96
+ setShowCaption( false );
97
+ }
98
+ }, [ isSelected, caption ] );
99
+
72
100
  function toggleAttribute( attribute ) {
73
101
  return ( newValue ) => {
74
102
  setAttributes( { [ attribute ]: newValue } );
@@ -106,12 +134,20 @@ function AudioEdit( {
106
134
  if ( ! media || ! media.url ) {
107
135
  // In this case there was an error and we should continue in the editing state
108
136
  // previous attributes should be removed because they may be temporary blob urls.
109
- setAttributes( { src: undefined, id: undefined } );
137
+ setAttributes( {
138
+ src: undefined,
139
+ id: undefined,
140
+ caption: undefined,
141
+ } );
110
142
  return;
111
143
  }
112
144
  // Sets the block's attribute and updates the edit component from the
113
145
  // selected media, then switches off the editing UI.
114
- setAttributes( { src: media.url, id: media.id } );
146
+ setAttributes( {
147
+ src: media.url,
148
+ id: media.id,
149
+ caption: media.caption,
150
+ } );
115
151
  }
116
152
 
117
153
  const classes = classnames( className, {
@@ -140,6 +176,23 @@ function AudioEdit( {
140
176
 
141
177
  return (
142
178
  <>
179
+ <BlockControls group="block">
180
+ <ToolbarButton
181
+ onClick={ () => {
182
+ setShowCaption( ! showCaption );
183
+ if ( showCaption && caption ) {
184
+ setAttributes( { caption: undefined } );
185
+ }
186
+ } }
187
+ icon={ captionIcon }
188
+ isPressed={ showCaption }
189
+ label={
190
+ showCaption
191
+ ? __( 'Remove caption' )
192
+ : __( 'Add caption' )
193
+ }
194
+ />
195
+ </BlockControls>
143
196
  <BlockControls group="other">
144
197
  <MediaReplaceFlow
145
198
  mediaId={ id }
@@ -195,26 +248,28 @@ function AudioEdit( {
195
248
  <audio controls="controls" src={ src } />
196
249
  </Disabled>
197
250
  { isTemporaryAudio && <Spinner /> }
198
- { ( ! RichText.isEmpty( caption ) || isSelected ) && (
199
- <RichText
200
- tagName="figcaption"
201
- className={ __experimentalGetElementClassName(
202
- 'caption'
203
- ) }
204
- aria-label={ __( 'Audio caption text' ) }
205
- placeholder={ __( 'Add caption' ) }
206
- value={ caption }
207
- onChange={ ( value ) =>
208
- setAttributes( { caption: value } )
209
- }
210
- inlineToolbar
211
- __unstableOnSplitAtEnd={ () =>
212
- insertBlocksAfter(
213
- createBlock( getDefaultBlockName() )
214
- )
215
- }
216
- />
217
- ) }
251
+ { showCaption &&
252
+ ( ! RichText.isEmpty( caption ) || isSelected ) && (
253
+ <RichText
254
+ tagName="figcaption"
255
+ className={ __experimentalGetElementClassName(
256
+ 'caption'
257
+ ) }
258
+ ref={ captionRef }
259
+ aria-label={ __( 'Audio caption text' ) }
260
+ placeholder={ __( 'Add caption' ) }
261
+ value={ caption }
262
+ onChange={ ( value ) =>
263
+ setAttributes( { caption: value } )
264
+ }
265
+ inlineToolbar
266
+ __unstableOnSplitAtEnd={ () =>
267
+ insertBlocksAfter(
268
+ createBlock( getDefaultBlockName() )
269
+ )
270
+ }
271
+ />
272
+ ) }
218
273
  </figure>
219
274
  </>
220
275
  );
@@ -221,7 +221,7 @@ function ButtonEdit( props ) {
221
221
  </BlockControls>
222
222
  { isSelected && ( isEditingURL || isURLSet ) && (
223
223
  <Popover
224
- position="bottom center"
224
+ placement="bottom"
225
225
  onClose={ () => {
226
226
  setIsEditingURL( false );
227
227
  richTextRef.current?.focus();
@@ -113,4 +113,6 @@ $blocks-block__margin: 0.5em;
113
113
  .wp-block-button.is-style-outline > .wp-block-button__link:not(.has-background),
114
114
  .wp-block-button .wp-block-button__link.is-style-outline:not(.has-background) {
115
115
  background-color: transparent;
116
+ // background-image is required to overwrite a gradient background
117
+ background-image: none;
116
118
  }
@@ -139,7 +139,7 @@ export default function ButtonsEdit( {
139
139
  }
140
140
  popoverProps={ {
141
141
  position: 'bottom right',
142
- isAlternate: true,
142
+ variant: 'toolbar',
143
143
  } }
144
144
  />
145
145
  </BlockControls>
@@ -9,9 +9,13 @@
9
9
  "textdomain": "default",
10
10
  "usesContext": [ "postId" ],
11
11
  "supports": {
12
- "reusable": false,
13
- "html": false,
14
12
  "align": true,
13
+ "html": false,
14
+ "reusable": false,
15
+ "spacing": {
16
+ "margin": true,
17
+ "padding": true
18
+ },
15
19
  "typography": {
16
20
  "fontSize": true,
17
21
  "lineHeight": true,
@@ -1,4 +1,6 @@
1
1
  .wp-block-comment-template {
2
+ // This block has customizable padding, border-box makes that more predictable.
3
+ box-sizing: border-box;
2
4
  margin-bottom: 0;
3
5
  max-width: 100%;
4
6
  list-style: none;
@@ -3,7 +3,6 @@
3
3
  */
4
4
  import { Fragment, useMemo } from '@wordpress/element';
5
5
  import {
6
- BaseControl,
7
6
  Button,
8
7
  ExternalLink,
9
8
  FocalPointPicker,
@@ -73,18 +72,17 @@ function CoverHeightInput( {
73
72
  const min = isPx ? COVER_MIN_HEIGHT : 0;
74
73
 
75
74
  return (
76
- <BaseControl label={ __( 'Minimum height of cover' ) } id={ inputId }>
77
- <UnitControl
78
- id={ inputId }
79
- isResetValueOnUnitChange
80
- min={ min }
81
- onChange={ handleOnChange }
82
- onUnitChange={ onUnitChange }
83
- style={ { maxWidth: 80 } }
84
- units={ units }
85
- value={ computedValue }
86
- />
87
- </BaseControl>
75
+ <UnitControl
76
+ label={ __( 'Minimum height of cover' ) }
77
+ id={ inputId }
78
+ isResetValueOnUnitChange
79
+ min={ min }
80
+ onChange={ handleOnChange }
81
+ onUnitChange={ onUnitChange }
82
+ __unstableInputWidth={ '80px' }
83
+ units={ units }
84
+ value={ computedValue }
85
+ />
88
86
  );
89
87
  }
90
88
  export default function CoverInspectorControls( {
@@ -11,36 +11,63 @@ import metadata from './block.json';
11
11
  /**
12
12
  * WordPress dependencies
13
13
  */
14
- import { RichText } from '@wordpress/block-editor';
14
+ import { RichText, useBlockProps } from '@wordpress/block-editor';
15
15
 
16
16
  const { attributes: blockAttributes } = metadata;
17
17
 
18
- const deprecated = [
19
- {
20
- attributes: blockAttributes,
21
- save( { attributes: { url, caption, type, providerNameSlug } } ) {
22
- if ( ! url ) {
23
- return null;
24
- }
25
-
26
- const embedClassName = classnames( 'wp-block-embed', {
27
- [ `is-type-${ type }` ]: type,
28
- [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
29
- } );
30
-
31
- return (
32
- <figure className={ embedClassName }>
18
+ // In #41140 support was added to global styles for caption elements which added a `wp-element-caption` classname
19
+ // to the embed figcaption element.
20
+ const v2 = {
21
+ attributes: blockAttributes,
22
+ save( { attributes } ) {
23
+ const { url, caption, type, providerNameSlug } = attributes;
24
+
25
+ if ( ! url ) {
26
+ return null;
27
+ }
28
+
29
+ const className = classnames( 'wp-block-embed', {
30
+ [ `is-type-${ type }` ]: type,
31
+ [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
32
+ [ `wp-block-embed-${ providerNameSlug }` ]: providerNameSlug,
33
+ } );
34
+
35
+ return (
36
+ <figure { ...useBlockProps.save( { className } ) }>
37
+ <div className="wp-block-embed__wrapper">
33
38
  { `\n${ url }\n` /* URL needs to be on its own line. */ }
34
- { ! RichText.isEmpty( caption ) && (
35
- <RichText.Content
36
- tagName="figcaption"
37
- value={ caption }
38
- />
39
- ) }
40
- </figure>
41
- );
42
- },
39
+ </div>
40
+ { ! RichText.isEmpty( caption ) && (
41
+ <RichText.Content tagName="figcaption" value={ caption } />
42
+ ) }
43
+ </figure>
44
+ );
45
+ },
46
+ };
47
+
48
+ const v1 = {
49
+ attributes: blockAttributes,
50
+ save( { attributes: { url, caption, type, providerNameSlug } } ) {
51
+ if ( ! url ) {
52
+ return null;
53
+ }
54
+
55
+ const embedClassName = classnames( 'wp-block-embed', {
56
+ [ `is-type-${ type }` ]: type,
57
+ [ `is-provider-${ providerNameSlug }` ]: providerNameSlug,
58
+ } );
59
+
60
+ return (
61
+ <figure className={ embedClassName }>
62
+ { `\n${ url }\n` /* URL needs to be on its own line. */ }
63
+ { ! RichText.isEmpty( caption ) && (
64
+ <RichText.Content tagName="figcaption" value={ caption } />
65
+ ) }
66
+ </figure>
67
+ );
43
68
  },
44
- ];
69
+ };
70
+
71
+ const deprecated = [ v2, v1 ];
45
72
 
46
73
  export default deprecated;