@wordpress/block-library 9.14.0 → 9.15.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 (344) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/LICENSE.md +1 -1
  3. package/build/archives/edit.js +83 -36
  4. package/build/archives/edit.js.map +1 -1
  5. package/build/button/deprecated.js +182 -1
  6. package/build/button/deprecated.js.map +1 -1
  7. package/build/button/edit.js +47 -25
  8. package/build/button/edit.js.map +1 -1
  9. package/build/button/index.js +8 -2
  10. package/build/button/index.js.map +1 -1
  11. package/build/button/save.js +8 -5
  12. package/build/button/save.js.map +1 -1
  13. package/build/column/edit.js +33 -13
  14. package/build/column/edit.js.map +1 -1
  15. package/build/columns/edit.js +50 -27
  16. package/build/columns/edit.js.map +1 -1
  17. package/build/comments/index.js +1 -0
  18. package/build/comments/index.js.map +1 -1
  19. package/build/cover/edit/index.js +9 -3
  20. package/build/cover/edit/index.js.map +1 -1
  21. package/build/cover/edit.native.js +1 -1
  22. package/build/cover/edit.native.js.map +1 -1
  23. package/build/details/edit.js +29 -7
  24. package/build/details/edit.js.map +1 -1
  25. package/build/image/transforms.js +1 -0
  26. package/build/image/transforms.js.map +1 -1
  27. package/build/latest-posts/deprecated.js +12 -0
  28. package/build/latest-posts/deprecated.js.map +1 -1
  29. package/build/latest-posts/index.js +12 -0
  30. package/build/latest-posts/index.js.map +1 -1
  31. package/build/loginout/edit.js +42 -13
  32. package/build/loginout/edit.js.map +1 -1
  33. package/build/media-text/edit.js +59 -31
  34. package/build/media-text/edit.js.map +1 -1
  35. package/build/more/edit.js +28 -7
  36. package/build/more/edit.js.map +1 -1
  37. package/build/navigation/edit/navigation-menu-selector.js +5 -3
  38. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  39. package/build/navigation-link/edit.js +95 -55
  40. package/build/navigation-link/edit.js.map +1 -1
  41. package/build/navigation-submenu/edit.js +105 -53
  42. package/build/navigation-submenu/edit.js.map +1 -1
  43. package/build/page-list/edit.js +44 -25
  44. package/build/page-list/edit.js.map +1 -1
  45. package/build/paragraph/edit.js +14 -4
  46. package/build/paragraph/edit.js.map +1 -1
  47. package/build/post-author/edit.js +15 -3
  48. package/build/post-author/edit.js.map +1 -1
  49. package/build/post-author/index.js +4 -2
  50. package/build/post-author/index.js.map +1 -1
  51. package/build/post-author-name/edit.js +11 -5
  52. package/build/post-author-name/edit.js.map +1 -1
  53. package/build/post-author-name/index.js +4 -2
  54. package/build/post-author-name/index.js.map +1 -1
  55. package/build/post-comments-form/index.js +6 -1
  56. package/build/post-comments-form/index.js.map +1 -1
  57. package/build/post-comments-link/index.js +8 -1
  58. package/build/post-comments-link/index.js.map +1 -1
  59. package/build/post-date/edit.js +58 -18
  60. package/build/post-date/edit.js.map +1 -1
  61. package/build/post-date/index.js +2 -1
  62. package/build/post-date/index.js.map +1 -1
  63. package/build/post-excerpt/edit.js +42 -18
  64. package/build/post-excerpt/edit.js.map +1 -1
  65. package/build/post-featured-image/dimension-controls.js +17 -19
  66. package/build/post-featured-image/dimension-controls.js.map +1 -1
  67. package/build/post-featured-image/edit.js +45 -11
  68. package/build/post-featured-image/edit.js.map +1 -1
  69. package/build/post-featured-image/index.js +6 -3
  70. package/build/post-featured-image/index.js.map +1 -1
  71. package/build/post-navigation-link/index.js +11 -7
  72. package/build/post-navigation-link/index.js.map +1 -1
  73. package/build/post-navigation-link/variations.js +2 -2
  74. package/build/post-navigation-link/variations.js.map +1 -1
  75. package/build/post-template/index.js +11 -1
  76. package/build/post-template/index.js.map +1 -1
  77. package/build/post-title/index.js +6 -3
  78. package/build/post-title/index.js.map +1 -1
  79. package/build/query-no-results/index.js +10 -9
  80. package/build/query-no-results/index.js.map +1 -1
  81. package/build/query-pagination/edit.js +47 -17
  82. package/build/query-pagination/edit.js.map +1 -1
  83. package/build/query-pagination/query-pagination-label-control.js +1 -1
  84. package/build/query-pagination/query-pagination-label-control.js.map +1 -1
  85. package/build/query-pagination-numbers/edit.js +33 -15
  86. package/build/query-pagination-numbers/edit.js.map +1 -1
  87. package/build/query-total/edit.js +8 -10
  88. package/build/query-total/edit.js.map +1 -1
  89. package/build/query-total/index.js +8 -1
  90. package/build/query-total/index.js.map +1 -1
  91. package/build/read-more/index.js +7 -1
  92. package/build/read-more/index.js.map +1 -1
  93. package/build/site-logo/index.js +4 -2
  94. package/build/site-logo/index.js.map +1 -1
  95. package/build/site-title/edit.js +41 -12
  96. package/build/site-title/edit.js.map +1 -1
  97. package/build/site-title/index.js +4 -2
  98. package/build/site-title/index.js.map +1 -1
  99. package/build/social-link/edit.js +19 -3
  100. package/build/social-link/edit.js.map +1 -1
  101. package/build/social-links/edit.js +41 -12
  102. package/build/social-links/edit.js.map +1 -1
  103. package/build/spacer/controls.js +34 -12
  104. package/build/spacer/controls.js.map +1 -1
  105. package/build/table/edit.js +48 -15
  106. package/build/table/edit.js.map +1 -1
  107. package/build/table/index.js +4 -1
  108. package/build/table/index.js.map +1 -1
  109. package/build/table-of-contents/edit.js +1 -1
  110. package/build/table-of-contents/edit.js.map +1 -1
  111. package/build/table-of-contents/index.js +24 -23
  112. package/build/table-of-contents/index.js.map +1 -1
  113. package/build/tag-cloud/edit.js +56 -11
  114. package/build/tag-cloud/edit.js.map +1 -1
  115. package/build/video/edit-common-settings.js +90 -30
  116. package/build/video/edit-common-settings.js.map +1 -1
  117. package/build/video/edit.js +20 -49
  118. package/build/video/edit.js.map +1 -1
  119. package/build/video/poster-image.js +81 -0
  120. package/build/video/poster-image.js.map +1 -0
  121. package/build/video/tracks-editor.js +1 -1
  122. package/build/video/tracks-editor.js.map +1 -1
  123. package/build-module/archives/edit.js +84 -37
  124. package/build-module/archives/edit.js.map +1 -1
  125. package/build-module/button/deprecated.js +183 -2
  126. package/build-module/button/deprecated.js.map +1 -1
  127. package/build-module/button/edit.js +50 -28
  128. package/build-module/button/edit.js.map +1 -1
  129. package/build-module/button/index.js +8 -2
  130. package/build-module/button/index.js.map +1 -1
  131. package/build-module/button/save.js +9 -6
  132. package/build-module/button/save.js.map +1 -1
  133. package/build-module/column/edit.js +34 -14
  134. package/build-module/column/edit.js.map +1 -1
  135. package/build-module/columns/edit.js +52 -29
  136. package/build-module/columns/edit.js.map +1 -1
  137. package/build-module/comments/index.js +1 -0
  138. package/build-module/comments/index.js.map +1 -1
  139. package/build-module/cover/edit/index.js +9 -3
  140. package/build-module/cover/edit/index.js.map +1 -1
  141. package/build-module/cover/edit.native.js +2 -2
  142. package/build-module/cover/edit.native.js.map +1 -1
  143. package/build-module/details/edit.js +30 -8
  144. package/build-module/details/edit.js.map +1 -1
  145. package/build-module/image/transforms.js +1 -0
  146. package/build-module/image/transforms.js.map +1 -1
  147. package/build-module/latest-posts/deprecated.js +12 -0
  148. package/build-module/latest-posts/deprecated.js.map +1 -1
  149. package/build-module/latest-posts/index.js +12 -0
  150. package/build-module/latest-posts/index.js.map +1 -1
  151. package/build-module/loginout/edit.js +42 -14
  152. package/build-module/loginout/edit.js.map +1 -1
  153. package/build-module/media-text/edit.js +59 -31
  154. package/build-module/media-text/edit.js.map +1 -1
  155. package/build-module/more/edit.js +28 -8
  156. package/build-module/more/edit.js.map +1 -1
  157. package/build-module/navigation/edit/navigation-menu-selector.js +5 -3
  158. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  159. package/build-module/navigation-link/edit.js +96 -56
  160. package/build-module/navigation-link/edit.js.map +1 -1
  161. package/build-module/navigation-submenu/edit.js +106 -54
  162. package/build-module/navigation-submenu/edit.js.map +1 -1
  163. package/build-module/page-list/edit.js +45 -26
  164. package/build-module/page-list/edit.js.map +1 -1
  165. package/build-module/paragraph/edit.js +15 -6
  166. package/build-module/paragraph/edit.js.map +1 -1
  167. package/build-module/post-author/edit.js +16 -4
  168. package/build-module/post-author/edit.js.map +1 -1
  169. package/build-module/post-author/index.js +4 -2
  170. package/build-module/post-author/index.js.map +1 -1
  171. package/build-module/post-author-name/edit.js +12 -6
  172. package/build-module/post-author-name/edit.js.map +1 -1
  173. package/build-module/post-author-name/index.js +4 -2
  174. package/build-module/post-author-name/index.js.map +1 -1
  175. package/build-module/post-comments-form/index.js +6 -1
  176. package/build-module/post-comments-form/index.js.map +1 -1
  177. package/build-module/post-comments-link/index.js +8 -1
  178. package/build-module/post-comments-link/index.js.map +1 -1
  179. package/build-module/post-date/edit.js +59 -19
  180. package/build-module/post-date/edit.js.map +1 -1
  181. package/build-module/post-date/index.js +2 -1
  182. package/build-module/post-date/index.js.map +1 -1
  183. package/build-module/post-excerpt/edit.js +44 -20
  184. package/build-module/post-excerpt/edit.js.map +1 -1
  185. package/build-module/post-featured-image/dimension-controls.js +18 -20
  186. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  187. package/build-module/post-featured-image/edit.js +47 -13
  188. package/build-module/post-featured-image/edit.js.map +1 -1
  189. package/build-module/post-featured-image/index.js +6 -3
  190. package/build-module/post-featured-image/index.js.map +1 -1
  191. package/build-module/post-navigation-link/index.js +12 -7
  192. package/build-module/post-navigation-link/index.js.map +1 -1
  193. package/build-module/post-navigation-link/variations.js +2 -2
  194. package/build-module/post-navigation-link/variations.js.map +1 -1
  195. package/build-module/post-template/index.js +11 -1
  196. package/build-module/post-template/index.js.map +1 -1
  197. package/build-module/post-title/index.js +6 -3
  198. package/build-module/post-title/index.js.map +1 -1
  199. package/build-module/query-no-results/index.js +10 -9
  200. package/build-module/query-no-results/index.js.map +1 -1
  201. package/build-module/query-pagination/edit.js +49 -19
  202. package/build-module/query-pagination/edit.js.map +1 -1
  203. package/build-module/query-pagination/query-pagination-label-control.js +1 -1
  204. package/build-module/query-pagination/query-pagination-label-control.js.map +1 -1
  205. package/build-module/query-pagination-numbers/edit.js +34 -16
  206. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  207. package/build-module/query-total/edit.js +8 -10
  208. package/build-module/query-total/edit.js.map +1 -1
  209. package/build-module/query-total/index.js +8 -1
  210. package/build-module/query-total/index.js.map +1 -1
  211. package/build-module/read-more/index.js +7 -1
  212. package/build-module/read-more/index.js.map +1 -1
  213. package/build-module/site-logo/index.js +4 -2
  214. package/build-module/site-logo/index.js.map +1 -1
  215. package/build-module/site-title/edit.js +42 -13
  216. package/build-module/site-title/edit.js.map +1 -1
  217. package/build-module/site-title/index.js +4 -2
  218. package/build-module/site-title/index.js.map +1 -1
  219. package/build-module/social-link/edit.js +20 -4
  220. package/build-module/social-link/edit.js.map +1 -1
  221. package/build-module/social-links/edit.js +42 -13
  222. package/build-module/social-links/edit.js.map +1 -1
  223. package/build-module/spacer/controls.js +35 -13
  224. package/build-module/spacer/controls.js.map +1 -1
  225. package/build-module/table/edit.js +49 -16
  226. package/build-module/table/edit.js.map +1 -1
  227. package/build-module/table/index.js +4 -1
  228. package/build-module/table/index.js.map +1 -1
  229. package/build-module/table-of-contents/edit.js +1 -1
  230. package/build-module/table-of-contents/edit.js.map +1 -1
  231. package/build-module/table-of-contents/index.js +26 -25
  232. package/build-module/table-of-contents/index.js.map +1 -1
  233. package/build-module/tag-cloud/edit.js +57 -12
  234. package/build-module/tag-cloud/edit.js.map +1 -1
  235. package/build-module/video/edit-common-settings.js +91 -31
  236. package/build-module/video/edit-common-settings.js.map +1 -1
  237. package/build-module/video/edit.js +24 -53
  238. package/build-module/video/edit.js.map +1 -1
  239. package/build-module/video/poster-image.js +74 -0
  240. package/build-module/video/poster-image.js.map +1 -0
  241. package/build-module/video/tracks-editor.js +1 -1
  242. package/build-module/video/tracks-editor.js.map +1 -1
  243. package/build-style/comment-template/style-rtl.css +0 -1
  244. package/build-style/comment-template/style.css +0 -1
  245. package/build-style/editor-rtl.css +4 -19
  246. package/build-style/editor.css +4 -19
  247. package/build-style/form-input/style-rtl.css +0 -2
  248. package/build-style/form-input/style.css +0 -2
  249. package/build-style/freeform/editor-rtl.css +4 -8
  250. package/build-style/freeform/editor.css +4 -8
  251. package/build-style/{post-template/editor.css → post-comments-link/style-rtl.css} +2 -4
  252. package/build-style/{post-template/editor-rtl.css → post-comments-link/style.css} +2 -4
  253. package/build-style/post-template/style-rtl.css +1 -0
  254. package/build-style/post-template/style.css +1 -0
  255. package/build-style/query-total/style-rtl.css +103 -0
  256. package/build-style/query-total/style.css +103 -0
  257. package/build-style/read-more/style-rtl.css +0 -1
  258. package/build-style/read-more/style.css +0 -1
  259. package/build-style/style-rtl.css +9 -4
  260. package/build-style/style.css +9 -4
  261. package/build-style/tag-cloud/editor-rtl.css +0 -5
  262. package/build-style/tag-cloud/editor.css +0 -5
  263. package/package.json +35 -35
  264. package/src/archives/edit.js +94 -36
  265. package/src/audio/test/__snapshots__/edit.native.js.snap +1 -1
  266. package/src/block/index.php +20 -0
  267. package/src/button/block.json +17 -2
  268. package/src/button/deprecated.js +189 -0
  269. package/src/button/edit.js +60 -31
  270. package/src/button/save.js +6 -1
  271. package/src/column/edit.js +34 -13
  272. package/src/columns/edit.js +71 -40
  273. package/src/comments/index.js +1 -0
  274. package/src/cover/edit/index.js +12 -5
  275. package/src/cover/edit.native.js +5 -2
  276. package/src/cover/test/edit.js +5 -7
  277. package/src/details/edit.js +40 -11
  278. package/src/editor.scss +0 -1
  279. package/src/file/test/__snapshots__/edit.native.js.snap +1 -1
  280. package/src/image/transforms.js +1 -0
  281. package/src/latest-posts/block.json +12 -0
  282. package/src/loginout/edit.js +56 -20
  283. package/src/media-text/edit.js +57 -28
  284. package/src/more/edit.js +39 -12
  285. package/src/navigation/edit/navigation-menu-selector.js +9 -2
  286. package/src/navigation/index.php +2 -2
  287. package/src/navigation-link/edit.js +101 -61
  288. package/src/navigation-link/index.php +16 -1
  289. package/src/navigation-submenu/edit.js +113 -57
  290. package/src/page-list/edit.js +52 -31
  291. package/src/paragraph/edit.js +18 -4
  292. package/src/post-author/block.json +4 -2
  293. package/src/post-author/edit.js +17 -3
  294. package/src/post-author/index.php +4 -0
  295. package/src/post-author-name/block.json +4 -2
  296. package/src/post-author-name/edit.js +17 -4
  297. package/src/post-author-name/index.php +4 -0
  298. package/src/post-comments-form/block.json +6 -1
  299. package/src/post-comments-link/block.json +8 -1
  300. package/src/post-comments-link/style.scss +4 -0
  301. package/src/post-content/index.php +23 -0
  302. package/src/post-date/block.json +2 -1
  303. package/src/post-date/edit.js +79 -25
  304. package/src/post-excerpt/edit.js +59 -22
  305. package/src/post-featured-image/block.json +6 -3
  306. package/src/post-featured-image/dimension-controls.js +18 -21
  307. package/src/post-featured-image/edit.js +67 -10
  308. package/src/post-navigation-link/block.json +0 -6
  309. package/src/post-navigation-link/index.js +11 -0
  310. package/src/post-navigation-link/variations.js +2 -2
  311. package/src/post-template/block.json +11 -1
  312. package/src/post-template/style.scss +2 -0
  313. package/src/post-title/block.json +6 -3
  314. package/src/query-no-results/block.json +0 -10
  315. package/src/query-no-results/index.js +11 -0
  316. package/src/query-pagination/edit.js +57 -15
  317. package/src/query-pagination/query-pagination-label-control.js +1 -3
  318. package/src/query-pagination-numbers/edit.js +41 -19
  319. package/src/query-pagination-previous/index.php +21 -14
  320. package/src/query-total/block.json +8 -1
  321. package/src/query-total/edit.js +11 -13
  322. package/src/query-total/index.php +9 -13
  323. package/src/query-total/style.scss +4 -0
  324. package/src/read-more/index.js +6 -0
  325. package/src/site-logo/block.json +4 -2
  326. package/src/site-title/block.json +4 -2
  327. package/src/site-title/edit.js +52 -15
  328. package/src/social-link/edit.js +21 -6
  329. package/src/social-links/edit.js +52 -15
  330. package/src/spacer/controls.js +42 -15
  331. package/src/style.scss +2 -0
  332. package/src/table/block.json +4 -1
  333. package/src/table/edit.js +58 -20
  334. package/src/table-of-contents/block.json +0 -52
  335. package/src/table-of-contents/edit.js +1 -1
  336. package/src/table-of-contents/index.js +53 -0
  337. package/src/tag-cloud/edit.js +60 -8
  338. package/src/tag-cloud/editor.scss +0 -8
  339. package/src/video/edit-common-settings.js +97 -39
  340. package/src/video/edit.js +29 -75
  341. package/src/video/poster-image.js +86 -0
  342. package/src/video/tracks-editor.js +1 -1
  343. package/tsconfig.json +0 -2
  344. package/src/post-template/editor.scss +0 -7
@@ -4,14 +4,14 @@
4
4
  import {
5
5
  Flex,
6
6
  FlexItem,
7
- PanelBody,
8
7
  ToggleControl,
9
8
  SelectControl,
10
9
  RangeControl,
11
10
  __experimentalUnitControl as UnitControl,
12
11
  __experimentalUseCustomUnits as useCustomUnits,
13
12
  __experimentalParseQuantityAndUnitFromRawValue as parseQuantityAndUnitFromRawValue,
14
- __experimentalVStack as VStack,
13
+ __experimentalToolsPanel as ToolsPanel,
14
+ __experimentalToolsPanelItem as ToolsPanelItem,
15
15
  Disabled,
16
16
  } from '@wordpress/components';
17
17
  import { useSelect } from '@wordpress/data';
@@ -24,6 +24,11 @@ import {
24
24
  import ServerSideRender from '@wordpress/server-side-render';
25
25
  import { store as coreStore } from '@wordpress/core-data';
26
26
 
27
+ /**
28
+ * Internal dependencies
29
+ */
30
+ import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
31
+
27
32
  /**
28
33
  * Minimum number of tags a user can show using this block.
29
34
  *
@@ -51,6 +56,7 @@ function TagCloudEdit( { attributes, setAttributes } ) {
51
56
  } = attributes;
52
57
 
53
58
  const [ availableUnits ] = useSettings( 'spacing.units' );
59
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
54
60
 
55
61
  // The `pt` unit is used as the default value and is therefore
56
62
  // always considered an available unit.
@@ -118,10 +124,26 @@ function TagCloudEdit( { attributes, setAttributes } ) {
118
124
 
119
125
  const inspectorControls = (
120
126
  <InspectorControls>
121
- <PanelBody title={ __( 'Settings' ) }>
122
- <VStack
123
- spacing={ 4 }
124
- className="wp-block-tag-cloud__inspector-settings"
127
+ <ToolsPanel
128
+ label={ __( 'Settings' ) }
129
+ resetAll={ () => {
130
+ setAttributes( {
131
+ taxonomy: 'post_tag',
132
+ showTagCounts: false,
133
+ numberOfTags: 45,
134
+ smallestFontSize: '8pt',
135
+ largestFontSize: '22pt',
136
+ } );
137
+ } }
138
+ dropdownMenuProps={ dropdownMenuProps }
139
+ >
140
+ <ToolsPanelItem
141
+ hasValue={ () => taxonomy !== 'post_tag' }
142
+ label={ __( 'Taxonomy' ) }
143
+ onDeselect={ () =>
144
+ setAttributes( { taxonomy: 'post_tag' } )
145
+ }
146
+ isShownByDefault
125
147
  >
126
148
  <SelectControl
127
149
  __nextHasNoMarginBottom
@@ -133,6 +155,20 @@ function TagCloudEdit( { attributes, setAttributes } ) {
133
155
  setAttributes( { taxonomy: selectedTaxonomy } )
134
156
  }
135
157
  />
158
+ </ToolsPanelItem>
159
+ <ToolsPanelItem
160
+ hasValue={ () =>
161
+ smallestFontSize !== '8pt' || largestFontSize !== '22pt'
162
+ }
163
+ label={ __( 'Font size' ) }
164
+ onDeselect={ () =>
165
+ setAttributes( {
166
+ smallestFontSize: '8pt',
167
+ largestFontSize: '22pt',
168
+ } )
169
+ }
170
+ isShownByDefault
171
+ >
136
172
  <Flex gap={ 4 }>
137
173
  <FlexItem isBlock>
138
174
  <UnitControl
@@ -167,6 +203,13 @@ function TagCloudEdit( { attributes, setAttributes } ) {
167
203
  />
168
204
  </FlexItem>
169
205
  </Flex>
206
+ </ToolsPanelItem>
207
+ <ToolsPanelItem
208
+ hasValue={ () => numberOfTags !== 45 }
209
+ label={ __( 'Number of tags' ) }
210
+ onDeselect={ () => setAttributes( { numberOfTags: 45 } ) }
211
+ isShownByDefault
212
+ >
170
213
  <RangeControl
171
214
  __nextHasNoMarginBottom
172
215
  __next40pxDefaultSize
@@ -179,6 +222,15 @@ function TagCloudEdit( { attributes, setAttributes } ) {
179
222
  max={ MAX_TAGS }
180
223
  required
181
224
  />
225
+ </ToolsPanelItem>
226
+ <ToolsPanelItem
227
+ hasValue={ () => showTagCounts !== false }
228
+ label={ __( 'Show tag counts' ) }
229
+ onDeselect={ () =>
230
+ setAttributes( { showTagCounts: false } )
231
+ }
232
+ isShownByDefault
233
+ >
182
234
  <ToggleControl
183
235
  __nextHasNoMarginBottom
184
236
  label={ __( 'Show tag counts' ) }
@@ -187,8 +239,8 @@ function TagCloudEdit( { attributes, setAttributes } ) {
187
239
  setAttributes( { showTagCounts: ! showTagCounts } )
188
240
  }
189
241
  />
190
- </VStack>
191
- </PanelBody>
242
+ </ToolsPanelItem>
243
+ </ToolsPanel>
192
244
  </InspectorControls>
193
245
  );
194
246
 
@@ -9,11 +9,3 @@
9
9
  border: none;
10
10
  border-radius: inherit;
11
11
  }
12
-
13
- .wp-block-tag-cloud__inspector-settings {
14
- .components-base-control,
15
- .components-base-control:last-child {
16
- // Cancel out extra margins added by block inspector
17
- margin-bottom: 0;
18
- }
19
- }
@@ -2,7 +2,11 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __, _x } from '@wordpress/i18n';
5
- import { ToggleControl, SelectControl } from '@wordpress/components';
5
+ import {
6
+ ToggleControl,
7
+ SelectControl,
8
+ __experimentalToolsPanelItem as ToolsPanelItem,
9
+ } from '@wordpress/components';
6
10
  import { useMemo, useCallback, Platform } from '@wordpress/element';
7
11
 
8
12
  const options = [
@@ -47,50 +51,104 @@ const VideoSettings = ( { setAttributes, attributes } ) => {
47
51
 
48
52
  return (
49
53
  <>
50
- <ToggleControl
51
- __nextHasNoMarginBottom
54
+ <ToolsPanelItem
52
55
  label={ __( 'Autoplay' ) }
53
- onChange={ toggleFactory.autoplay }
54
- checked={ !! autoplay }
55
- help={ getAutoplayHelp }
56
- />
57
- <ToggleControl
58
- __nextHasNoMarginBottom
56
+ isShownByDefault
57
+ hasValue={ () => !! autoplay }
58
+ onDeselect={ () => {
59
+ setAttributes( { autoplay: false } );
60
+ } }
61
+ >
62
+ <ToggleControl
63
+ __nextHasNoMarginBottom
64
+ label={ __( 'Autoplay' ) }
65
+ onChange={ toggleFactory.autoplay }
66
+ checked={ !! autoplay }
67
+ help={ getAutoplayHelp }
68
+ />
69
+ </ToolsPanelItem>
70
+ <ToolsPanelItem
59
71
  label={ __( 'Loop' ) }
60
- onChange={ toggleFactory.loop }
61
- checked={ !! loop }
62
- />
63
- <ToggleControl
64
- __nextHasNoMarginBottom
72
+ isShownByDefault
73
+ hasValue={ () => !! loop }
74
+ onDeselect={ () => {
75
+ setAttributes( { loop: false } );
76
+ } }
77
+ >
78
+ <ToggleControl
79
+ __nextHasNoMarginBottom
80
+ label={ __( 'Loop' ) }
81
+ onChange={ toggleFactory.loop }
82
+ checked={ !! loop }
83
+ />
84
+ </ToolsPanelItem>
85
+ <ToolsPanelItem
65
86
  label={ __( 'Muted' ) }
66
- onChange={ toggleFactory.muted }
67
- checked={ !! muted }
68
- />
69
- <ToggleControl
70
- __nextHasNoMarginBottom
87
+ isShownByDefault
88
+ hasValue={ () => !! muted }
89
+ onDeselect={ () => {
90
+ setAttributes( { muted: false } );
91
+ } }
92
+ >
93
+ <ToggleControl
94
+ __nextHasNoMarginBottom
95
+ label={ __( 'Muted' ) }
96
+ onChange={ toggleFactory.muted }
97
+ checked={ !! muted }
98
+ />
99
+ </ToolsPanelItem>
100
+ <ToolsPanelItem
71
101
  label={ __( 'Playback controls' ) }
72
- onChange={ toggleFactory.controls }
73
- checked={ !! controls }
74
- />
75
- <ToggleControl
76
- __nextHasNoMarginBottom
77
- /* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */
102
+ isShownByDefault
103
+ hasValue={ () => ! controls }
104
+ onDeselect={ () => {
105
+ setAttributes( { controls: true } );
106
+ } }
107
+ >
108
+ <ToggleControl
109
+ __nextHasNoMarginBottom
110
+ label={ __( 'Playback controls' ) }
111
+ onChange={ toggleFactory.controls }
112
+ checked={ !! controls }
113
+ />
114
+ </ToolsPanelItem>
115
+ <ToolsPanelItem
78
116
  label={ __( 'Play inline' ) }
79
- onChange={ toggleFactory.playsInline }
80
- checked={ !! playsInline }
81
- help={ __(
82
- 'When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.'
83
- ) }
84
- />
85
- <SelectControl
86
- __next40pxDefaultSize
87
- __nextHasNoMarginBottom
117
+ isShownByDefault
118
+ hasValue={ () => !! playsInline }
119
+ onDeselect={ () => {
120
+ setAttributes( { playsInline: false } );
121
+ } }
122
+ >
123
+ <ToggleControl
124
+ __nextHasNoMarginBottom
125
+ /* translators: Setting to play videos within the webpage on mobile browsers rather than opening in a fullscreen player. */
126
+ label={ __( 'Play inline' ) }
127
+ onChange={ toggleFactory.playsInline }
128
+ checked={ playsInline }
129
+ help={ __(
130
+ 'When enabled, videos will play directly within the webpage on mobile browsers, instead of opening in a fullscreen player.'
131
+ ) }
132
+ />
133
+ </ToolsPanelItem>
134
+ <ToolsPanelItem
88
135
  label={ __( 'Preload' ) }
89
- value={ preload }
90
- onChange={ onChangePreload }
91
- options={ options }
92
- hideCancelButton
93
- />
136
+ isShownByDefault
137
+ hasValue={ () => preload !== 'metadata' }
138
+ onDeselect={ () => {
139
+ setAttributes( { preload: 'metadata' } );
140
+ } }
141
+ >
142
+ <SelectControl
143
+ __next40pxDefaultSize
144
+ __nextHasNoMarginBottom
145
+ label={ __( 'Preload' ) }
146
+ value={ preload }
147
+ onChange={ onChangePreload }
148
+ options={ options }
149
+ hideCancelButton
150
+ />
151
+ </ToolsPanelItem>
94
152
  </>
95
153
  );
96
154
  };
package/src/video/edit.js CHANGED
@@ -8,25 +8,21 @@ import clsx from 'clsx';
8
8
  */
9
9
  import { isBlobURL } from '@wordpress/blob';
10
10
  import {
11
- BaseControl,
12
- Button,
13
11
  Disabled,
14
- PanelBody,
15
12
  Spinner,
16
13
  Placeholder,
14
+ __experimentalToolsPanel as ToolsPanel,
17
15
  } from '@wordpress/components';
18
16
  import {
19
17
  BlockControls,
20
18
  BlockIcon,
21
19
  InspectorControls,
22
20
  MediaPlaceholder,
23
- MediaUpload,
24
- MediaUploadCheck,
25
21
  MediaReplaceFlow,
26
22
  useBlockProps,
27
23
  } from '@wordpress/block-editor';
28
24
  import { useRef, useEffect, useState } from '@wordpress/element';
29
- import { __, sprintf } from '@wordpress/i18n';
25
+ import { __ } from '@wordpress/i18n';
30
26
  import { useInstanceId } from '@wordpress/compose';
31
27
  import { useDispatch } from '@wordpress/data';
32
28
  import { video as icon } from '@wordpress/icons';
@@ -35,15 +31,18 @@ import { store as noticesStore } from '@wordpress/notices';
35
31
  /**
36
32
  * Internal dependencies
37
33
  */
34
+ import PosterImage from './poster-image';
38
35
  import { createUpgradedEmbedBlock } from '../embed/util';
39
- import { useUploadMediaFromBlobURL } from '../utils/hooks';
36
+ import {
37
+ useUploadMediaFromBlobURL,
38
+ useToolsPanelDropdownMenuProps,
39
+ } from '../utils/hooks';
40
40
  import VideoCommonSettings from './edit-common-settings';
41
41
  import TracksEditor from './tracks-editor';
42
42
  import Tracks from './tracks';
43
43
  import { Caption } from '../utils/caption';
44
44
 
45
45
  const ALLOWED_MEDIA_TYPES = [ 'video' ];
46
- const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
47
46
 
48
47
  function VideoEdit( {
49
48
  isSelected: isSingleSelected,
@@ -55,9 +54,9 @@ function VideoEdit( {
55
54
  } ) {
56
55
  const instanceId = useInstanceId( VideoEdit );
57
56
  const videoPlayer = useRef();
58
- const posterImageButton = useRef();
59
57
  const { id, controls, poster, src, tracks } = attributes;
60
58
  const [ temporaryURL, setTemporaryURL ] = useState( attributes.blob );
59
+ const dropdownMenuProps = useToolsPanelDropdownMenuProps();
61
60
 
62
61
  useUploadMediaFromBlobURL( {
63
62
  url: temporaryURL,
@@ -174,19 +173,6 @@ function VideoEdit( {
174
173
  );
175
174
  }
176
175
 
177
- function onSelectPoster( image ) {
178
- setAttributes( { poster: image.url } );
179
- }
180
-
181
- function onRemovePoster() {
182
- setAttributes( { poster: undefined } );
183
-
184
- // Move focus back to the Media Upload button.
185
- posterImageButton.current.focus();
186
- }
187
-
188
- const videoPosterDescription = `video-block__poster-image-description-${ instanceId }`;
189
-
190
176
  return (
191
177
  <>
192
178
  { isSingleSelected && (
@@ -214,63 +200,31 @@ function VideoEdit( {
214
200
  </>
215
201
  ) }
216
202
  <InspectorControls>
217
- <PanelBody title={ __( 'Settings' ) }>
203
+ <ToolsPanel
204
+ label={ __( 'Settings' ) }
205
+ resetAll={ () => {
206
+ setAttributes( {
207
+ autoplay: false,
208
+ controls: true,
209
+ loop: false,
210
+ muted: false,
211
+ playsInline: false,
212
+ preload: 'metadata',
213
+ poster: '',
214
+ } );
215
+ } }
216
+ dropdownMenuProps={ dropdownMenuProps }
217
+ >
218
218
  <VideoCommonSettings
219
219
  setAttributes={ setAttributes }
220
220
  attributes={ attributes }
221
221
  />
222
- <MediaUploadCheck>
223
- <div className="editor-video-poster-control">
224
- <BaseControl.VisualLabel>
225
- { __( 'Poster image' ) }
226
- </BaseControl.VisualLabel>
227
- <MediaUpload
228
- title={ __( 'Select poster image' ) }
229
- onSelect={ onSelectPoster }
230
- allowedTypes={
231
- VIDEO_POSTER_ALLOWED_MEDIA_TYPES
232
- }
233
- render={ ( { open } ) => (
234
- <Button
235
- __next40pxDefaultSize
236
- variant="primary"
237
- onClick={ open }
238
- ref={ posterImageButton }
239
- aria-describedby={
240
- videoPosterDescription
241
- }
242
- >
243
- { ! poster
244
- ? __( 'Select' )
245
- : __( 'Replace' ) }
246
- </Button>
247
- ) }
248
- />
249
- <p id={ videoPosterDescription } hidden>
250
- { poster
251
- ? sprintf(
252
- /* translators: %s: poster image URL. */
253
- __(
254
- 'The current poster image url is %s'
255
- ),
256
- poster
257
- )
258
- : __(
259
- 'There is no poster image currently selected'
260
- ) }
261
- </p>
262
- { !! poster && (
263
- <Button
264
- __next40pxDefaultSize
265
- onClick={ onRemovePoster }
266
- variant="tertiary"
267
- >
268
- { __( 'Remove' ) }
269
- </Button>
270
- ) }
271
- </div>
272
- </MediaUploadCheck>
273
- </PanelBody>
222
+ <PosterImage
223
+ poster={ poster }
224
+ setAttributes={ setAttributes }
225
+ instanceId={ instanceId }
226
+ />
227
+ </ToolsPanel>
274
228
  </InspectorControls>
275
229
  <figure { ...blockProps }>
276
230
  { /*
@@ -0,0 +1,86 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
5
+ import {
6
+ Button,
7
+ BaseControl,
8
+ __experimentalToolsPanelItem as ToolsPanelItem,
9
+ } from '@wordpress/components';
10
+ import { __, sprintf } from '@wordpress/i18n';
11
+ import { useRef } from '@wordpress/element';
12
+
13
+ function PosterImage( { poster, setAttributes, instanceId } ) {
14
+ const posterImageButton = useRef();
15
+ const VIDEO_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
16
+
17
+ const videoPosterDescription = `video-block__poster-image-description-${ instanceId }`;
18
+
19
+ function onSelectPoster( image ) {
20
+ setAttributes( { poster: image.url } );
21
+ }
22
+
23
+ function onRemovePoster() {
24
+ setAttributes( { poster: undefined } );
25
+
26
+ // Move focus back to the Media Upload button.
27
+ posterImageButton.current.focus();
28
+ }
29
+
30
+ return (
31
+ <ToolsPanelItem
32
+ label={ __( 'Poster image' ) }
33
+ isShownByDefault
34
+ hasValue={ () => !! poster }
35
+ onDeselect={ () => {
36
+ setAttributes( { poster: '' } );
37
+ } }
38
+ >
39
+ <MediaUploadCheck>
40
+ <div className="editor-video-poster-control">
41
+ <BaseControl.VisualLabel>
42
+ { __( 'Poster image' ) }
43
+ </BaseControl.VisualLabel>
44
+ <MediaUpload
45
+ title={ __( 'Select poster image' ) }
46
+ onSelect={ onSelectPoster }
47
+ allowedTypes={ VIDEO_POSTER_ALLOWED_MEDIA_TYPES }
48
+ render={ ( { open } ) => (
49
+ <Button
50
+ __next40pxDefaultSize
51
+ variant="primary"
52
+ onClick={ open }
53
+ ref={ posterImageButton }
54
+ aria-describedby={ videoPosterDescription }
55
+ >
56
+ { ! poster ? __( 'Select' ) : __( 'Replace' ) }
57
+ </Button>
58
+ ) }
59
+ />
60
+ <p id={ videoPosterDescription } hidden>
61
+ { poster
62
+ ? sprintf(
63
+ /* translators: %s: poster image URL. */
64
+ __( 'The current poster image url is %s' ),
65
+ poster
66
+ )
67
+ : __(
68
+ 'There is no poster image currently selected'
69
+ ) }
70
+ </p>
71
+ { !! poster && (
72
+ <Button
73
+ __next40pxDefaultSize
74
+ onClick={ onRemovePoster }
75
+ variant="tertiary"
76
+ >
77
+ { __( 'Remove' ) }
78
+ </Button>
79
+ ) }
80
+ </div>
81
+ </MediaUploadCheck>
82
+ </ToolsPanelItem>
83
+ );
84
+ }
85
+
86
+ export default PosterImage;
@@ -323,7 +323,7 @@ export default function TracksEditor( { tracks = [], onChange } ) {
323
323
  openFileDialog();
324
324
  } }
325
325
  >
326
- { __( 'Upload' ) }
326
+ { _x( 'Upload', 'verb' ) }
327
327
  </MenuItem>
328
328
  );
329
329
  } }
package/tsconfig.json CHANGED
@@ -2,8 +2,6 @@
2
2
  "$schema": "https://json.schemastore.org/tsconfig.json",
3
3
  "extends": "../../tsconfig.base.json",
4
4
  "compilerOptions": {
5
- "rootDir": "src",
6
- "declarationDir": "build-types",
7
5
  "types": [ "gutenberg-env" ],
8
6
  "strictNullChecks": true
9
7
  },
@@ -1,7 +0,0 @@
1
- .editor-styles-wrapper {
2
- ul.wp-block-post-template {
3
- padding-left: 0;
4
- margin-left: 0;
5
- list-style: none;
6
- }
7
- }