@wordpress/block-library 10.2.0 → 10.3.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 (308) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/build/accordion-panel/block.json +1 -0
  3. package/build/code/edit.cjs +3 -1
  4. package/build/code/edit.cjs.map +2 -2
  5. package/build/cover/block.json +1 -0
  6. package/build/cover/edit/block-controls.cjs +3 -1
  7. package/build/cover/edit/block-controls.cjs.map +2 -2
  8. package/build/cover/edit/index.cjs +75 -31
  9. package/build/cover/edit/index.cjs.map +2 -2
  10. package/build/embed/edit.cjs +1 -1
  11. package/build/embed/edit.cjs.map +2 -2
  12. package/build/embed/embed-placeholder.cjs +1 -1
  13. package/build/embed/embed-placeholder.cjs.map +2 -2
  14. package/build/gallery/dynamic-gallery.cjs +104 -61
  15. package/build/gallery/dynamic-gallery.cjs.map +3 -3
  16. package/build/gallery/use-dynamic-gallery.cjs +15 -8
  17. package/build/gallery/use-dynamic-gallery.cjs.map +2 -2
  18. package/build/heading/edit.cjs +1 -1
  19. package/build/heading/edit.cjs.map +2 -2
  20. package/build/html/modal.cjs +63 -54
  21. package/build/html/modal.cjs.map +3 -3
  22. package/build/icon/block.json +5 -3
  23. package/build/image/edit.cjs +1 -1
  24. package/build/image/edit.cjs.map +2 -2
  25. package/build/image/image.cjs +29 -5
  26. package/build/image/image.cjs.map +3 -3
  27. package/build/image/use-open-image-media-editor-modal.cjs +6 -2
  28. package/build/image/use-open-image-media-editor-modal.cjs.map +2 -2
  29. package/build/list-item/hooks/use-indent-list-item.cjs +10 -2
  30. package/build/list-item/hooks/use-indent-list-item.cjs.map +2 -2
  31. package/build/math/edit.cjs +39 -56
  32. package/build/math/edit.cjs.map +3 -3
  33. package/build/media-text/edit.cjs +2 -1
  34. package/build/media-text/edit.cjs.map +2 -2
  35. package/build/more/edit.cjs +2 -2
  36. package/build/more/edit.cjs.map +2 -2
  37. package/build/navigation/edit/index.cjs +30 -16
  38. package/build/navigation/edit/index.cjs.map +3 -3
  39. package/build/navigation/edit/use-layout-custom-properties.cjs +72 -0
  40. package/build/navigation/edit/use-layout-custom-properties.cjs.map +7 -0
  41. package/build/navigation/view.cjs +9 -6
  42. package/build/navigation/view.cjs.map +2 -2
  43. package/build/navigation-link/edit.cjs +3 -3
  44. package/build/navigation-link/edit.cjs.map +2 -2
  45. package/build/navigation-link/link-ui/index.cjs +2 -2
  46. package/build/navigation-link/link-ui/index.cjs.map +2 -2
  47. package/build/paragraph/block.json +0 -1
  48. package/build/paragraph/edit.cjs +5 -2
  49. package/build/paragraph/edit.cjs.map +3 -3
  50. package/build/paragraph/index.cjs +4 -1
  51. package/build/paragraph/index.cjs.map +2 -2
  52. package/build/playlist/context.cjs +2 -1
  53. package/build/playlist/context.cjs.map +2 -2
  54. package/build/playlist/edit.cjs +113 -26
  55. package/build/playlist/edit.cjs.map +2 -2
  56. package/build/playlist/utils.cjs +19 -4
  57. package/build/playlist/utils.cjs.map +2 -2
  58. package/build/playlist-track/edit.cjs +21 -6
  59. package/build/playlist-track/edit.cjs.map +2 -2
  60. package/build/post-content/edit.cjs +36 -15
  61. package/build/post-content/edit.cjs.map +2 -2
  62. package/build/post-featured-image/edit.cjs +3 -2
  63. package/build/post-featured-image/edit.cjs.map +2 -2
  64. package/build/post-terms/edit.cjs +2 -2
  65. package/build/post-terms/edit.cjs.map +2 -2
  66. package/build/post-title/edit.cjs +2 -2
  67. package/build/post-title/edit.cjs.map +2 -2
  68. package/build/preformatted/edit.cjs +3 -1
  69. package/build/preformatted/edit.cjs.map +2 -2
  70. package/build/pullquote/edit.cjs +5 -3
  71. package/build/pullquote/edit.cjs.map +2 -2
  72. package/build/query/edit/inspector-controls/index.cjs +4 -1
  73. package/build/query/edit/inspector-controls/index.cjs.map +2 -2
  74. package/build/query/edit/inspector-controls/offset-controls.cjs +1 -1
  75. package/build/query/edit/inspector-controls/offset-controls.cjs.map +2 -2
  76. package/build/read-more/edit.cjs +3 -1
  77. package/build/read-more/edit.cjs.map +2 -2
  78. package/build/site-tagline/edit.cjs +3 -1
  79. package/build/site-tagline/edit.cjs.map +2 -2
  80. package/build/site-title/edit.cjs +3 -1
  81. package/build/site-title/edit.cjs.map +2 -2
  82. package/build/social-links/edit.cjs +11 -4
  83. package/build/social-links/edit.cjs.map +2 -2
  84. package/build/tab-list/block.json +2 -1
  85. package/build/tab-list/edit.cjs +2 -0
  86. package/build/tab-list/edit.cjs.map +3 -3
  87. package/build/tab-list/tab-movers.cjs +87 -0
  88. package/build/tab-list/tab-movers.cjs.map +7 -0
  89. package/build/tab-panel/edit.cjs +1 -9
  90. package/build/tab-panel/edit.cjs.map +2 -2
  91. package/build/table/edit.cjs +1 -1
  92. package/build/table/edit.cjs.map +2 -2
  93. package/build/tabs/use-tab-actions.cjs +23 -1
  94. package/build/tabs/use-tab-actions.cjs.map +2 -2
  95. package/build/utils/caption.cjs +2 -2
  96. package/build/utils/caption.cjs.map +2 -2
  97. package/build/verse/edit.cjs +3 -1
  98. package/build/verse/edit.cjs.map +2 -2
  99. package/build/video/tracks-editor.cjs +0 -1
  100. package/build/video/tracks-editor.cjs.map +2 -2
  101. package/build-module/accordion-panel/block.json +1 -0
  102. package/build-module/code/edit.mjs +3 -1
  103. package/build-module/code/edit.mjs.map +2 -2
  104. package/build-module/cover/block.json +1 -0
  105. package/build-module/cover/edit/block-controls.mjs +3 -1
  106. package/build-module/cover/edit/block-controls.mjs.map +2 -2
  107. package/build-module/cover/edit/index.mjs +78 -34
  108. package/build-module/cover/edit/index.mjs.map +2 -2
  109. package/build-module/embed/edit.mjs +1 -1
  110. package/build-module/embed/edit.mjs.map +2 -2
  111. package/build-module/embed/embed-placeholder.mjs +1 -1
  112. package/build-module/embed/embed-placeholder.mjs.map +2 -2
  113. package/build-module/gallery/dynamic-gallery.mjs +104 -61
  114. package/build-module/gallery/dynamic-gallery.mjs.map +2 -2
  115. package/build-module/gallery/use-dynamic-gallery.mjs +16 -9
  116. package/build-module/gallery/use-dynamic-gallery.mjs.map +2 -2
  117. package/build-module/heading/edit.mjs +1 -1
  118. package/build-module/heading/edit.mjs.map +2 -2
  119. package/build-module/html/modal.mjs +68 -55
  120. package/build-module/html/modal.mjs.map +2 -2
  121. package/build-module/icon/block.json +5 -3
  122. package/build-module/image/edit.mjs +1 -1
  123. package/build-module/image/edit.mjs.map +2 -2
  124. package/build-module/image/image.mjs +19 -5
  125. package/build-module/image/image.mjs.map +2 -2
  126. package/build-module/image/use-open-image-media-editor-modal.mjs +6 -2
  127. package/build-module/image/use-open-image-media-editor-modal.mjs.map +2 -2
  128. package/build-module/list-item/hooks/use-indent-list-item.mjs +10 -2
  129. package/build-module/list-item/hooks/use-indent-list-item.mjs.map +2 -2
  130. package/build-module/math/edit.mjs +41 -60
  131. package/build-module/math/edit.mjs.map +2 -2
  132. package/build-module/media-text/edit.mjs +2 -1
  133. package/build-module/media-text/edit.mjs.map +2 -2
  134. package/build-module/more/edit.mjs +2 -2
  135. package/build-module/more/edit.mjs.map +2 -2
  136. package/build-module/navigation/edit/index.mjs +30 -16
  137. package/build-module/navigation/edit/index.mjs.map +2 -2
  138. package/build-module/navigation/edit/use-layout-custom-properties.mjs +51 -0
  139. package/build-module/navigation/edit/use-layout-custom-properties.mjs.map +7 -0
  140. package/build-module/navigation/view.mjs +9 -6
  141. package/build-module/navigation/view.mjs.map +2 -2
  142. package/build-module/navigation-link/edit.mjs +3 -3
  143. package/build-module/navigation-link/edit.mjs.map +2 -2
  144. package/build-module/navigation-link/link-ui/index.mjs +2 -2
  145. package/build-module/navigation-link/link-ui/index.mjs.map +2 -2
  146. package/build-module/paragraph/block.json +0 -1
  147. package/build-module/paragraph/edit.mjs +6 -2
  148. package/build-module/paragraph/edit.mjs.map +2 -2
  149. package/build-module/paragraph/index.mjs +4 -1
  150. package/build-module/paragraph/index.mjs.map +2 -2
  151. package/build-module/playlist/context.mjs +2 -1
  152. package/build-module/playlist/context.mjs.map +2 -2
  153. package/build-module/playlist/edit.mjs +113 -27
  154. package/build-module/playlist/edit.mjs.map +2 -2
  155. package/build-module/playlist/utils.mjs +19 -4
  156. package/build-module/playlist/utils.mjs.map +2 -2
  157. package/build-module/playlist-track/edit.mjs +21 -6
  158. package/build-module/playlist-track/edit.mjs.map +2 -2
  159. package/build-module/post-content/edit.mjs +37 -15
  160. package/build-module/post-content/edit.mjs.map +2 -2
  161. package/build-module/post-featured-image/edit.mjs +3 -2
  162. package/build-module/post-featured-image/edit.mjs.map +2 -2
  163. package/build-module/post-terms/edit.mjs +2 -2
  164. package/build-module/post-terms/edit.mjs.map +2 -2
  165. package/build-module/post-title/edit.mjs +2 -2
  166. package/build-module/post-title/edit.mjs.map +2 -2
  167. package/build-module/preformatted/edit.mjs +3 -1
  168. package/build-module/preformatted/edit.mjs.map +2 -2
  169. package/build-module/pullquote/edit.mjs +5 -3
  170. package/build-module/pullquote/edit.mjs.map +2 -2
  171. package/build-module/query/edit/inspector-controls/index.mjs +5 -2
  172. package/build-module/query/edit/inspector-controls/index.mjs.map +2 -2
  173. package/build-module/query/edit/inspector-controls/offset-controls.mjs +2 -2
  174. package/build-module/query/edit/inspector-controls/offset-controls.mjs.map +2 -2
  175. package/build-module/read-more/edit.mjs +3 -1
  176. package/build-module/read-more/edit.mjs.map +2 -2
  177. package/build-module/site-tagline/edit.mjs +3 -1
  178. package/build-module/site-tagline/edit.mjs.map +2 -2
  179. package/build-module/site-title/edit.mjs +3 -1
  180. package/build-module/site-title/edit.mjs.map +2 -2
  181. package/build-module/social-links/edit.mjs +11 -4
  182. package/build-module/social-links/edit.mjs.map +2 -2
  183. package/build-module/tab-list/block.json +2 -1
  184. package/build-module/tab-list/edit.mjs +2 -0
  185. package/build-module/tab-list/edit.mjs.map +2 -2
  186. package/build-module/tab-list/tab-movers.mjs +59 -0
  187. package/build-module/tab-list/tab-movers.mjs.map +7 -0
  188. package/build-module/tab-panel/edit.mjs +1 -9
  189. package/build-module/tab-panel/edit.mjs.map +2 -2
  190. package/build-module/table/edit.mjs +1 -1
  191. package/build-module/table/edit.mjs.map +2 -2
  192. package/build-module/tabs/use-tab-actions.mjs +23 -1
  193. package/build-module/tabs/use-tab-actions.mjs.map +2 -2
  194. package/build-module/utils/caption.mjs +2 -2
  195. package/build-module/utils/caption.mjs.map +2 -2
  196. package/build-module/verse/edit.mjs +3 -1
  197. package/build-module/verse/edit.mjs.map +2 -2
  198. package/build-module/video/tracks-editor.mjs +0 -1
  199. package/build-module/video/tracks-editor.mjs.map +2 -2
  200. package/build-style/cover/editor-rtl.css +3 -0
  201. package/build-style/cover/editor.css +3 -0
  202. package/build-style/editor-rtl.css +18 -41
  203. package/build-style/editor.css +18 -41
  204. package/build-style/icon/editor-rtl.css +1 -4
  205. package/build-style/icon/editor.css +1 -4
  206. package/build-style/image/editor-rtl.css +3 -32
  207. package/build-style/image/editor.css +3 -32
  208. package/build-style/playlist/editor-rtl.css +0 -5
  209. package/build-style/playlist/editor.css +0 -5
  210. package/build-style/playlist/style-rtl.css +44 -4
  211. package/build-style/playlist/style.css +44 -4
  212. package/build-style/pullquote/editor-rtl.css +4 -0
  213. package/build-style/pullquote/editor.css +4 -0
  214. package/build-style/style-rtl.css +44 -4
  215. package/build-style/style.css +44 -4
  216. package/build-style/tab-list/editor-rtl.css +101 -0
  217. package/build-style/tab-list/editor.css +101 -0
  218. package/package.json +43 -43
  219. package/src/accordion-panel/block.json +1 -0
  220. package/src/breadcrumbs/index.php +3 -1
  221. package/src/button/index.php +1 -1
  222. package/src/code/edit.js +7 -2
  223. package/src/cover/block.json +1 -0
  224. package/src/cover/edit/block-controls.js +5 -0
  225. package/src/cover/edit/index.js +100 -35
  226. package/src/cover/editor.scss +6 -0
  227. package/src/cover/index.php +9 -2
  228. package/src/editor.scss +1 -0
  229. package/src/embed/edit.js +3 -1
  230. package/src/embed/embed-placeholder.js +9 -7
  231. package/src/form/index.php +6 -4
  232. package/src/gallery/dynamic-gallery.js +133 -74
  233. package/src/gallery/use-dynamic-gallery.js +27 -12
  234. package/src/heading/edit.js +1 -1
  235. package/src/html/modal.js +13 -2
  236. package/src/icon/README.md +1 -3
  237. package/src/icon/block.json +5 -3
  238. package/src/icon/editor.scss +1 -4
  239. package/src/image/edit.js +1 -5
  240. package/src/image/editor.scss +6 -46
  241. package/src/image/image.js +37 -3
  242. package/src/image/test/use-open-image-media-editor-modal.js +37 -1
  243. package/src/image/use-open-image-media-editor-modal.js +8 -1
  244. package/src/latest-posts/index.php +3 -2
  245. package/src/list-item/hooks/use-indent-list-item.js +10 -1
  246. package/src/math/edit.js +42 -59
  247. package/src/media-text/edit.js +1 -0
  248. package/src/media-text/index.php +11 -2
  249. package/src/more/edit.js +7 -4
  250. package/src/navigation/edit/index.js +52 -36
  251. package/src/navigation/edit/test/layout-custom-properties.js +138 -0
  252. package/src/navigation/edit/use-layout-custom-properties.js +84 -0
  253. package/src/navigation/index.php +123 -12
  254. package/src/navigation/test/view.js +51 -0
  255. package/src/navigation/view.js +15 -14
  256. package/src/navigation-link/edit.js +11 -7
  257. package/src/navigation-link/index.php +64 -0
  258. package/src/navigation-link/link-ui/index.js +2 -1
  259. package/src/navigation-link/test/__snapshots__/hooks.js.snap +1 -1
  260. package/src/page-list/index.php +4 -3
  261. package/src/paragraph/README.md +0 -1
  262. package/src/paragraph/block.json +0 -1
  263. package/src/paragraph/edit.js +9 -2
  264. package/src/paragraph/index.js +4 -1
  265. package/src/pattern/index.php +5 -5
  266. package/src/playlist/context.js +1 -0
  267. package/src/playlist/edit.js +151 -47
  268. package/src/playlist/editor.scss +0 -7
  269. package/src/playlist/index.php +14 -9
  270. package/src/playlist/style.scss +3 -0
  271. package/src/playlist/test/edit-component.js +139 -0
  272. package/src/playlist/test/edit.js +30 -0
  273. package/src/playlist/utils.js +25 -4
  274. package/src/playlist-track/edit.js +22 -5
  275. package/src/playlist-track/index.php +8 -7
  276. package/src/playlist-track/test/edit.js +87 -3
  277. package/src/post-content/edit.js +45 -16
  278. package/src/post-excerpt/index.php +4 -1
  279. package/src/post-featured-image/edit.js +3 -2
  280. package/src/post-featured-image/index.php +4 -1
  281. package/src/post-terms/edit.js +7 -4
  282. package/src/post-title/edit.js +5 -3
  283. package/src/preformatted/edit.js +7 -2
  284. package/src/pullquote/edit.js +9 -4
  285. package/src/pullquote/editor.scss +6 -0
  286. package/src/query/edit/inspector-controls/index.js +5 -2
  287. package/src/query/edit/inspector-controls/offset-controls.js +2 -2
  288. package/src/read-more/edit.js +7 -2
  289. package/src/rss/index.php +9 -3
  290. package/src/site-tagline/edit.js +7 -2
  291. package/src/site-title/edit.js +7 -2
  292. package/src/social-link/index.php +19 -9
  293. package/src/social-links/edit.js +21 -12
  294. package/src/tab-list/block.json +2 -1
  295. package/src/tab-list/edit.js +2 -0
  296. package/src/tab-list/editor.scss +9 -0
  297. package/src/tab-list/tab-movers.js +72 -0
  298. package/src/tab-panel/edit.js +1 -9
  299. package/src/table/edit.js +1 -1
  300. package/src/table-of-contents/index.php +386 -1
  301. package/src/tabs/use-tab-actions.js +32 -3
  302. package/src/tag-cloud/index.php +3 -2
  303. package/src/template-part/index.php +2 -1
  304. package/src/utils/caption.js +7 -4
  305. package/src/utils/test/waveform-utils.js +63 -0
  306. package/src/verse/edit.js +7 -2
  307. package/src/video/index.php +2 -2
  308. package/src/video/tracks-editor.js +0 -1
@@ -15,3 +15,9 @@
15
15
  .wp-block-pullquote__citation {
16
16
  color: inherit;
17
17
  }
18
+
19
+ // Ensure custom line-height values applied to the block are inherited by the
20
+ // paragraph instead of being overridden by the default editor styles.
21
+ .wp-block-pullquote[style*="line-height"] :where(p) {
22
+ line-height: inherit;
23
+ }
@@ -14,7 +14,7 @@ import {
14
14
  } from '@wordpress/components';
15
15
  import { useSelect } from '@wordpress/data';
16
16
  import { store as coreStore } from '@wordpress/core-data';
17
- import { __, sprintf } from '@wordpress/i18n';
17
+ import { __, _x, sprintf } from '@wordpress/i18n';
18
18
  import { debounce } from '@wordpress/compose';
19
19
  import { useState, useMemo } from '@wordpress/element';
20
20
 
@@ -367,7 +367,10 @@ export default function QueryInspectorControls( props ) {
367
367
  />
368
368
  </ToolsPanelItem>
369
369
  <ToolsPanelItem
370
- label={ __( 'Offset' ) }
370
+ label={ _x(
371
+ 'Offset',
372
+ 'Number of posts to skip in a query'
373
+ ) }
371
374
  hasValue={ () => offset > 0 }
372
375
  onDeselect={ () => setQuery( { offset: 0 } ) }
373
376
  >
@@ -2,7 +2,7 @@
2
2
  * WordPress dependencies
3
3
  */
4
4
  import { __experimentalNumberControl as NumberControl } from '@wordpress/components';
5
- import { __ } from '@wordpress/i18n';
5
+ import { _x } from '@wordpress/i18n';
6
6
 
7
7
  const MIN_OFFSET = 0;
8
8
  const MAX_OFFSET = 100;
@@ -10,7 +10,7 @@ const MAX_OFFSET = 100;
10
10
  export const OffsetControl = ( { offset = 0, onChange } ) => {
11
11
  return (
12
12
  <NumberControl
13
- label={ __( 'Offset' ) }
13
+ label={ _x( 'Offset', 'Number of posts to skip in a query' ) }
14
14
  value={ offset }
15
15
  min={ MIN_OFFSET }
16
16
  onChange={ ( newOffset ) => {
@@ -64,8 +64,13 @@ export default function ReadMore( {
64
64
  onChange={ ( newValue ) =>
65
65
  setAttributes( { content: newValue } )
66
66
  }
67
- __unstableOnSplitAtEnd={ () =>
68
- insertBlocksAfter( createBlock( getDefaultBlockName() ) )
67
+ __unstableOnSplitAtEnd={
68
+ insertBlocksAfter
69
+ ? () =>
70
+ insertBlocksAfter(
71
+ createBlock( getDefaultBlockName() )
72
+ )
73
+ : undefined
69
74
  }
70
75
  withoutInteractiveFormatting
71
76
  { ...blockProps }
package/src/rss/index.php CHANGED
@@ -15,11 +15,16 @@
15
15
  * @return string Returns the block content with received rss items.
16
16
  */
17
17
  function render_block_core_rss( $attributes ) {
18
- if ( in_array( untrailingslashit( $attributes['feedURL'] ), array( site_url(), home_url() ), true ) ) {
18
+ $feed_url = $attributes['feedURL'] ?? null;
19
+ if ( ! is_string( $feed_url ) ) {
20
+ return '';
21
+ }
22
+
23
+ if ( in_array( untrailingslashit( $feed_url ), array( site_url(), home_url() ), true ) ) {
19
24
  return '<div class="components-placeholder"><div class="notice notice-error">' . __( 'Adding an RSS feed to this site’s homepage is not supported, as it could lead to a loop that slows down your site. Try using another block, like the <strong>Latest Posts</strong> block, to list posts from the site.' ) . '</div></div>';
20
25
  }
21
26
 
22
- $rss = fetch_feed( $attributes['feedURL'] );
27
+ $rss = fetch_feed( $feed_url );
23
28
 
24
29
  if ( is_wp_error( $rss ) ) {
25
30
  return '<div class="components-placeholder"><div class="notice notice-error"><strong>' . __( 'RSS Error:' ) . '</strong> ' . esc_html( $rss->get_error_message() ) . '</div></div>';
@@ -33,7 +38,8 @@ function render_block_core_rss( $attributes ) {
33
38
  $list_items = '';
34
39
 
35
40
  $open_in_new_tab = ! empty( $attributes['openInNewTab'] );
36
- $rel = ! empty( $attributes['rel'] ) ? trim( $attributes['rel'] ) : '';
41
+ $rel_attr = $attributes['rel'] ?? null;
42
+ $rel = is_string( $rel_attr ) && '' !== $rel_attr ? trim( $rel_attr ) : '';
37
43
 
38
44
  $link_attributes = '';
39
45
 
@@ -59,8 +59,13 @@ export default function SiteTaglineEdit( props ) {
59
59
  tagName={ TagName }
60
60
  value={ tagline }
61
61
  disableLineBreaks
62
- __unstableOnSplitAtEnd={ () =>
63
- insertBlocksAfter( createBlock( getDefaultBlockName() ) )
62
+ __unstableOnSplitAtEnd={
63
+ insertBlocksAfter
64
+ ? () =>
65
+ insertBlocksAfter(
66
+ createBlock( getDefaultBlockName() )
67
+ )
68
+ : undefined
64
69
  }
65
70
  { ...blockProps }
66
71
  />
@@ -73,8 +73,13 @@ export default function SiteTitleEdit( props ) {
73
73
  onChange={ setTitle }
74
74
  allowedFormats={ [] }
75
75
  disableLineBreaks
76
- __unstableOnSplitAtEnd={ () =>
77
- insertBlocksAfter( createBlock( getDefaultBlockName() ) )
76
+ __unstableOnSplitAtEnd={
77
+ insertBlocksAfter
78
+ ? () =>
79
+ insertBlocksAfter(
80
+ createBlock( getDefaultBlockName() )
81
+ )
82
+ : undefined
78
83
  }
79
84
  />
80
85
  </TagName>
@@ -19,19 +19,26 @@
19
19
  function render_block_core_social_link( $attributes, $content, $block ) {
20
20
  $open_in_new_tab = $block->context['openInNewTab'] ?? false;
21
21
 
22
- $text = ! empty( $attributes['label'] ) ? trim( $attributes['label'] ) : '';
22
+ $label_attr = $attributes['label'] ?? null;
23
+ $text = is_string( $label_attr ) && '' !== $label_attr ? trim( $label_attr ) : '';
23
24
 
24
- $service = $attributes['service'] ?? 'Icon';
25
- $url = $attributes['url'] ?? false;
26
- $text = $text ? $text : block_core_social_link_get_name( $service );
27
- $rel = $attributes['rel'] ?? '';
28
- $show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;
25
+ $service_attr = $attributes['service'] ?? null;
26
+ $service = is_string( $service_attr ) ? $service_attr : 'Icon';
27
+ $url = $attributes['url'] ?? false;
28
+ $text = $text ? $text : block_core_social_link_get_name( $service );
29
+ $rel_attr = $attributes['rel'] ?? null;
30
+ $rel = is_string( $rel_attr ) ? $rel_attr : '';
31
+ $show_labels = array_key_exists( 'showLabels', $block->context ) ? $block->context['showLabels'] : false;
29
32
 
30
33
  // Don't render a link if there is no URL set.
31
34
  if ( ! $url ) {
32
35
  return '';
33
36
  }
34
37
 
38
+ if ( ! is_string( $url ) ) {
39
+ return '';
40
+ }
41
+
35
42
  /**
36
43
  * Prepend emails with `mailto:` if not set.
37
44
  * The `is_email` returns false for emails with schema.
@@ -100,7 +107,7 @@ add_action( 'init', 'register_block_core_social_link' );
100
107
  */
101
108
  function block_core_social_link_get_icon( $service ) {
102
109
  $services = block_core_social_link_services();
103
- if ( isset( $services[ $service ] ) && isset( $services[ $service ]['icon'] ) ) {
110
+ if ( is_string( $service ) && isset( $services[ $service ] ) && isset( $services[ $service ]['icon'] ) ) {
104
111
  return $services[ $service ]['icon'];
105
112
  }
106
113
 
@@ -118,7 +125,7 @@ function block_core_social_link_get_icon( $service ) {
118
125
  */
119
126
  function block_core_social_link_get_name( $service ) {
120
127
  $services = block_core_social_link_services();
121
- if ( isset( $services[ $service ] ) && isset( $services[ $service ]['name'] ) ) {
128
+ if ( is_string( $service ) && isset( $services[ $service ] ) && isset( $services[ $service ]['name'] ) ) {
122
129
  return $services[ $service ]['name'];
123
130
  }
124
131
 
@@ -136,6 +143,9 @@ function block_core_social_link_get_name( $service ) {
136
143
  * @return array|string
137
144
  */
138
145
  function block_core_social_link_services( $service = '', $field = '' ) {
146
+ if ( ! is_string( $service ) || ! is_string( $field ) ) {
147
+ return array();
148
+ }
139
149
  $services_data = array(
140
150
  'fivehundredpx' => array(
141
151
  'name' => _x( '500px', 'social link block variation name' ),
@@ -295,7 +305,7 @@ function block_core_social_link_services( $service = '', $field = '' ) {
295
305
  ),
296
306
  'tumblr' => array(
297
307
  'name' => _x( 'Tumblr', 'social link block variation name' ),
298
- 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z" /></path></svg>',
308
+ 'icon' => '<svg width="24" height="24" viewBox="0 0 24 24" version="1.1" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false"><path d="M17.04 21.28h-3.28c-2.84 0-4.94-1.37-4.94-5.02v-5.67H6.08V7.5c2.93-.73 4.11-3.3 4.3-5.48h3.01v4.93h3.47v3.65H13.4v4.93c0 1.47.73 2.01 1.92 2.01h1.73v3.75z"></path></svg>',
299
309
  ),
300
310
  'twitch' => array(
301
311
  'name' => _x( 'Twitch', 'social link block variation name' ),
@@ -30,6 +30,7 @@ import { useSelect } from '@wordpress/data';
30
30
  /**
31
31
  * Internal dependencies
32
32
  */
33
+ import { unlock } from '../lock-unlock';
33
34
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
34
35
 
35
36
  const sizeOptions = [
@@ -60,17 +61,23 @@ export function SocialLinksEdit( props ) {
60
61
  size,
61
62
  } = attributes;
62
63
 
63
- const { hasSocialIcons, hasSelectedChild } = useSelect(
64
- ( select ) => {
65
- const { getBlockCount, hasSelectedInnerBlock } =
66
- select( blockEditorStore );
67
- return {
68
- hasSocialIcons: getBlockCount( clientId ) > 0,
69
- hasSelectedChild: hasSelectedInnerBlock( clientId ),
70
- };
71
- },
72
- [ clientId ]
73
- );
64
+ const { hasSocialIcons, hasSelectedChild, hasSelectedStyleState } =
65
+ useSelect(
66
+ ( select ) => {
67
+ const {
68
+ getBlockCount,
69
+ hasSelectedInnerBlock,
70
+ hasSelectedStyleState: hasSelectedBlockStyleState,
71
+ } = unlock( select( blockEditorStore ) );
72
+ return {
73
+ hasSocialIcons: getBlockCount( clientId ) > 0,
74
+ hasSelectedChild: hasSelectedInnerBlock( clientId ),
75
+ hasSelectedStyleState:
76
+ hasSelectedBlockStyleState( clientId ),
77
+ };
78
+ },
79
+ [ clientId ]
80
+ );
74
81
 
75
82
  const hasAnySelected = isSelected || hasSelectedChild;
76
83
 
@@ -157,6 +164,8 @@ export function SocialLinksEdit( props ) {
157
164
  }
158
165
 
159
166
  const colorGradientSettings = useMultipleOriginColorsAndGradients();
167
+ const showColorControls =
168
+ colorGradientSettings.hasColorsOrGradients && ! hasSelectedStyleState;
160
169
 
161
170
  return (
162
171
  <>
@@ -227,7 +236,7 @@ export function SocialLinksEdit( props ) {
227
236
  </ToolsPanelItem>
228
237
  </ToolsPanel>
229
238
  </InspectorControls>
230
- { colorGradientSettings.hasColorsOrGradients && (
239
+ { showColorControls && (
231
240
  <InspectorControls group="color">
232
241
  { colorSettings.map(
233
242
  ( { onChange, label, value, resetAllFilter } ) => (
@@ -77,5 +77,6 @@
77
77
  "padding": ".wp-block-tab-list button"
78
78
  }
79
79
  },
80
- "style": "wp-block-tab-list"
80
+ "style": "wp-block-tab-list",
81
+ "editorStyle": "wp-block-tab-list-editor"
81
82
  }
@@ -28,6 +28,7 @@ import { useEffect, useMemo, useRef } from '@wordpress/element';
28
28
  * Internal dependencies
29
29
  */
30
30
  import TabToolbarControls from '../tabs/tab-toolbar-controls';
31
+ import TabMovers from './tab-movers';
31
32
  import useTabActions from '../tabs/use-tab-actions';
32
33
  import { useToolsPanelDropdownMenuProps } from '../utils/hooks';
33
34
 
@@ -199,6 +200,7 @@ function Edit( {
199
200
  </ToolsPanelItem>
200
201
  </ToolsPanel>
201
202
  </InspectorControls>
203
+ <TabMovers tabsClientId={ tabsClientId } />
202
204
  <TabToolbarControls tabsClientId={ tabsClientId } />
203
205
  <div { ...blockProps }>
204
206
  { tabsList.map( ( tab, index ) => {
@@ -0,0 +1,9 @@
1
+ @use "@wordpress/base-styles/mixins" as *;
2
+ @use "@wordpress/base-styles/variables" as *;
3
+
4
+ .wp-block-tab-list__mover-button {
5
+ @include break-small() {
6
+ width: $button-size-small;
7
+ min-width: 0 !important;
8
+ }
9
+ }
@@ -0,0 +1,72 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { __, isRTL } from '@wordpress/i18n';
5
+ import {
6
+ BlockControls,
7
+ store as blockEditorStore,
8
+ } from '@wordpress/block-editor';
9
+ import { ToolbarButton } from '@wordpress/components';
10
+ import { chevronLeft, chevronRight } from '@wordpress/icons';
11
+ import { useSelect } from '@wordpress/data';
12
+
13
+ /**
14
+ * Internal dependencies
15
+ */
16
+ import useTabActions from '../tabs/use-tab-actions';
17
+
18
+ /**
19
+ * Block toolbar buttons that reorder the active tab one position before or after.
20
+ * Reordering acts on the underlying core/tab-panel blocks; the tab-list labels
21
+ * follow their panel automatically via useTabListItemsSync. The buttons are
22
+ * disabled at the first/last position.
23
+ *
24
+ * @param {Object} props
25
+ * @param {string} props.tabsClientId The client ID of the parent tabs block.
26
+ * @return {React.JSX.Element} The toolbar control element.
27
+ */
28
+ export default function TabMovers( { tabsClientId } ) {
29
+ const { moveTab } = useTabActions( tabsClientId );
30
+ const { tabCount, activeIndex } = useSelect(
31
+ ( select ) => {
32
+ if ( ! tabsClientId ) {
33
+ return { tabCount: 0, activeIndex: 0 };
34
+ }
35
+ const { getBlocks, getBlockAttributes } =
36
+ select( blockEditorStore );
37
+ const tabsAttributes = getBlockAttributes( tabsClientId );
38
+ const tabPanels = getBlocks( tabsClientId ).find(
39
+ ( block ) => block.name === 'core/tab-panels'
40
+ );
41
+ return {
42
+ tabCount: tabPanels?.innerBlocks.length ?? 0,
43
+ activeIndex:
44
+ tabsAttributes?.editorActiveTabIndex ??
45
+ tabsAttributes?.activeTabIndex ??
46
+ 0,
47
+ };
48
+ },
49
+ [ tabsClientId ]
50
+ );
51
+
52
+ return (
53
+ <BlockControls group="parent">
54
+ <ToolbarButton
55
+ className="wp-block-tab-list__mover-button"
56
+ icon={ isRTL() ? chevronRight : chevronLeft }
57
+ label={ __( 'Move tab before' ) }
58
+ onClick={ () => moveTab( -1 ) }
59
+ disabled={ activeIndex <= 0 }
60
+ accessibleWhenDisabled
61
+ />
62
+ <ToolbarButton
63
+ className="wp-block-tab-list__mover-button"
64
+ icon={ isRTL() ? chevronLeft : chevronRight }
65
+ label={ __( 'Move tab after' ) }
66
+ onClick={ () => moveTab( 1 ) }
67
+ disabled={ activeIndex >= tabCount - 1 }
68
+ accessibleWhenDisabled
69
+ />
70
+ </BlockControls>
71
+ );
72
+ }
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { __ } from '@wordpress/i18n';
5
4
  import {
6
5
  useBlockProps,
7
6
  useInnerBlocksProps,
@@ -15,14 +14,7 @@ import { useEffect } from '@wordpress/element';
15
14
  */
16
15
  import Controls from './controls';
17
16
 
18
- const TEMPLATE = [
19
- [
20
- 'core/paragraph',
21
- {
22
- placeholder: __( 'Type / to choose a block' ),
23
- },
24
- ],
25
- ];
17
+ const TEMPLATE = [ [ 'core/paragraph' ] ];
26
18
 
27
19
  export default function Edit( { clientId, isSelected } ) {
28
20
  const {
package/src/table/edit.js CHANGED
@@ -455,7 +455,7 @@ function TableEdit( {
455
455
  <>
456
456
  <BlockControls group="block">
457
457
  <AlignmentControl
458
- label={ __( 'Change column alignment' ) }
458
+ label={ __( 'Align column content' ) }
459
459
  alignmentControls={ ALIGNMENT_CONTROLS }
460
460
  value={ getCellAlignment() }
461
461
  onChange={ ( nextAlign ) =>