@wordpress/block-library 9.11.0 → 9.12.1-next.082ed6819.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 (272) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block-keyboard-shortcuts/index.js +7 -7
  3. package/build/block-keyboard-shortcuts/index.js.map +1 -1
  4. package/build/button/index.js +1 -1
  5. package/build/button/index.js.map +1 -1
  6. package/build/cover/deprecated.js +140 -4
  7. package/build/cover/deprecated.js.map +1 -1
  8. package/build/cover/edit/block-controls.js +1 -1
  9. package/build/cover/edit/block-controls.js.map +1 -1
  10. package/build/cover/edit/cover-placeholder.js +1 -2
  11. package/build/cover/edit/cover-placeholder.js.map +1 -1
  12. package/build/cover/edit/index.js +23 -23
  13. package/build/cover/edit/index.js.map +1 -1
  14. package/build/cover/index.js +10 -10
  15. package/build/cover/index.js.map +1 -1
  16. package/build/cover/save.js +13 -13
  17. package/build/cover/save.js.map +1 -1
  18. package/build/cover/shared.js +6 -7
  19. package/build/cover/shared.js.map +1 -1
  20. package/build/details/index.js +20 -0
  21. package/build/details/index.js.map +1 -1
  22. package/build/file/edit.js +8 -4
  23. package/build/file/edit.js.map +1 -1
  24. package/build/freeform/modal.js +1 -1
  25. package/build/freeform/modal.js.map +1 -1
  26. package/build/gallery/edit.js +1 -1
  27. package/build/gallery/edit.js.map +1 -1
  28. package/build/heading/index.js +1 -7
  29. package/build/heading/index.js.map +1 -1
  30. package/build/home-link/edit.js +20 -36
  31. package/build/home-link/edit.js.map +1 -1
  32. package/build/image/edit.js +1 -1
  33. package/build/image/edit.js.map +1 -1
  34. package/build/image/image.js +144 -78
  35. package/build/image/image.js.map +1 -1
  36. package/build/image/index.js +1 -1
  37. package/build/latest-posts/edit.js +0 -1
  38. package/build/latest-posts/edit.js.map +1 -1
  39. package/build/lock-unlock.js.map +1 -1
  40. package/build/navigation/edit/index.js +2 -23
  41. package/build/navigation/edit/index.js.map +1 -1
  42. package/build/navigation/use-template-part-area-label.js +6 -8
  43. package/build/navigation/use-template-part-area-label.js.map +1 -1
  44. package/build/page-list/index.js +14 -0
  45. package/build/page-list/index.js.map +1 -1
  46. package/build/paragraph/edit.js +26 -25
  47. package/build/paragraph/edit.js.map +1 -1
  48. package/build/post-content/index.js +13 -0
  49. package/build/post-content/index.js.map +1 -1
  50. package/build/post-template/edit.js +11 -0
  51. package/build/post-template/edit.js.map +1 -1
  52. package/build/post-template/index.js +1 -1
  53. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
  54. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  55. package/build/query/edit/inspector-controls/index.js +3 -13
  56. package/build/query/edit/inspector-controls/index.js.map +1 -1
  57. package/build/query/edit/pattern-selection-modal.js +0 -3
  58. package/build/query/edit/pattern-selection-modal.js.map +1 -1
  59. package/build/query/edit/query-content.js +10 -12
  60. package/build/query/edit/query-content.js.map +1 -1
  61. package/build/query/index.js +1 -1
  62. package/build/query/utils.js +38 -9
  63. package/build/query/utils.js.map +1 -1
  64. package/build/social-link/edit.js +22 -9
  65. package/build/social-link/edit.js.map +1 -1
  66. package/build/template-part/edit/advanced-controls.js +2 -7
  67. package/build/template-part/edit/advanced-controls.js.map +1 -1
  68. package/build/template-part/edit/index.js +1 -4
  69. package/build/template-part/edit/index.js.map +1 -1
  70. package/build/template-part/edit/selection-modal.js +0 -3
  71. package/build/template-part/edit/selection-modal.js.map +1 -1
  72. package/build/template-part/edit/utils/get-template-part-icon.js +23 -0
  73. package/build/template-part/edit/utils/get-template-part-icon.js.map +1 -0
  74. package/build/template-part/edit/utils/hooks.js +1 -6
  75. package/build/template-part/edit/utils/hooks.js.map +1 -1
  76. package/build/template-part/variations.js +6 -12
  77. package/build/template-part/variations.js.map +1 -1
  78. package/build/video/edit.js +1 -1
  79. package/build/video/edit.js.map +1 -1
  80. package/build/video/tracks-editor.js +135 -123
  81. package/build/video/tracks-editor.js.map +1 -1
  82. package/build-module/block-keyboard-shortcuts/index.js +7 -7
  83. package/build-module/block-keyboard-shortcuts/index.js.map +1 -1
  84. package/build-module/button/index.js +1 -1
  85. package/build-module/button/index.js.map +1 -1
  86. package/build-module/cover/deprecated.js +140 -4
  87. package/build-module/cover/deprecated.js.map +1 -1
  88. package/build-module/cover/edit/block-controls.js +1 -1
  89. package/build-module/cover/edit/block-controls.js.map +1 -1
  90. package/build-module/cover/edit/cover-placeholder.js +1 -2
  91. package/build-module/cover/edit/cover-placeholder.js.map +1 -1
  92. package/build-module/cover/edit/index.js +23 -23
  93. package/build-module/cover/edit/index.js.map +1 -1
  94. package/build-module/cover/index.js +10 -10
  95. package/build-module/cover/index.js.map +1 -1
  96. package/build-module/cover/save.js +13 -13
  97. package/build-module/cover/save.js.map +1 -1
  98. package/build-module/cover/shared.js +6 -7
  99. package/build-module/cover/shared.js.map +1 -1
  100. package/build-module/details/index.js +21 -1
  101. package/build-module/details/index.js.map +1 -1
  102. package/build-module/file/edit.js +8 -4
  103. package/build-module/file/edit.js.map +1 -1
  104. package/build-module/freeform/modal.js +1 -1
  105. package/build-module/freeform/modal.js.map +1 -1
  106. package/build-module/gallery/edit.js +1 -1
  107. package/build-module/gallery/edit.js.map +1 -1
  108. package/build-module/heading/index.js +1 -7
  109. package/build-module/heading/index.js.map +1 -1
  110. package/build-module/home-link/edit.js +23 -39
  111. package/build-module/home-link/edit.js.map +1 -1
  112. package/build-module/image/edit.js +1 -1
  113. package/build-module/image/edit.js.map +1 -1
  114. package/build-module/image/image.js +149 -83
  115. package/build-module/image/image.js.map +1 -1
  116. package/build-module/image/index.js +1 -1
  117. package/build-module/latest-posts/edit.js +0 -1
  118. package/build-module/latest-posts/edit.js.map +1 -1
  119. package/build-module/lock-unlock.js.map +1 -1
  120. package/build-module/navigation/edit/index.js +2 -23
  121. package/build-module/navigation/edit/index.js.map +1 -1
  122. package/build-module/navigation/use-template-part-area-label.js +6 -8
  123. package/build-module/navigation/use-template-part-area-label.js.map +1 -1
  124. package/build-module/page-list/index.js +14 -0
  125. package/build-module/page-list/index.js.map +1 -1
  126. package/build-module/paragraph/edit.js +26 -25
  127. package/build-module/paragraph/edit.js.map +1 -1
  128. package/build-module/post-content/index.js +13 -0
  129. package/build-module/post-content/index.js.map +1 -1
  130. package/build-module/post-template/edit.js +11 -0
  131. package/build-module/post-template/edit.js.map +1 -1
  132. package/build-module/post-template/index.js +1 -1
  133. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +1 -3
  134. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  135. package/build-module/query/edit/inspector-controls/index.js +3 -13
  136. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  137. package/build-module/query/edit/pattern-selection-modal.js +0 -3
  138. package/build-module/query/edit/pattern-selection-modal.js.map +1 -1
  139. package/build-module/query/edit/query-content.js +10 -12
  140. package/build-module/query/edit/query-content.js.map +1 -1
  141. package/build-module/query/index.js +1 -1
  142. package/build-module/query/utils.js +35 -8
  143. package/build-module/query/utils.js.map +1 -1
  144. package/build-module/social-link/edit.js +24 -11
  145. package/build-module/social-link/edit.js.map +1 -1
  146. package/build-module/template-part/edit/advanced-controls.js +3 -8
  147. package/build-module/template-part/edit/advanced-controls.js.map +1 -1
  148. package/build-module/template-part/edit/index.js +1 -4
  149. package/build-module/template-part/edit/index.js.map +1 -1
  150. package/build-module/template-part/edit/selection-modal.js +0 -3
  151. package/build-module/template-part/edit/selection-modal.js.map +1 -1
  152. package/build-module/template-part/edit/utils/get-template-part-icon.js +15 -0
  153. package/build-module/template-part/edit/utils/get-template-part-icon.js.map +1 -0
  154. package/build-module/template-part/edit/utils/hooks.js +1 -6
  155. package/build-module/template-part/edit/utils/hooks.js.map +1 -1
  156. package/build-module/template-part/variations.js +5 -11
  157. package/build-module/template-part/variations.js.map +1 -1
  158. package/build-module/video/edit.js +1 -1
  159. package/build-module/video/edit.js.map +1 -1
  160. package/build-module/video/tracks-editor.js +136 -124
  161. package/build-module/video/tracks-editor.js.map +1 -1
  162. package/build-style/cover/editor-rtl.css +3 -5
  163. package/build-style/cover/editor.css +3 -5
  164. package/build-style/cover/style-rtl.css +19 -15
  165. package/build-style/cover/style.css +19 -15
  166. package/build-style/editor-rtl.css +19 -30
  167. package/build-style/editor.css +19 -30
  168. package/build-style/group/editor-rtl.css +0 -10
  169. package/build-style/group/editor.css +0 -10
  170. package/build-style/image/editor-rtl.css +4 -0
  171. package/build-style/image/editor.css +4 -0
  172. package/build-style/image/style-rtl.css +0 -2
  173. package/build-style/image/style.css +0 -2
  174. package/build-style/latest-posts/editor-rtl.css +0 -7
  175. package/build-style/latest-posts/editor.css +0 -7
  176. package/build-style/media-text/style-rtl.css +1 -1
  177. package/build-style/media-text/style.css +1 -1
  178. package/build-style/navigation/style-rtl.css +1 -1
  179. package/build-style/navigation/style.css +1 -1
  180. package/build-style/page-list/style-rtl.css +4 -0
  181. package/build-style/page-list/style.css +4 -0
  182. package/build-style/query/editor-rtl.css +0 -4
  183. package/build-style/query/editor.css +0 -4
  184. package/build-style/search/style-rtl.css +3 -3
  185. package/build-style/search/style.css +3 -3
  186. package/build-style/social-link/editor-rtl.css +4 -4
  187. package/build-style/social-link/editor.css +4 -4
  188. package/build-style/style-rtl.css +28 -22
  189. package/build-style/style.css +28 -22
  190. package/build-style/video/editor-rtl.css +8 -0
  191. package/build-style/video/editor.css +8 -0
  192. package/build-types/lock-unlock.d.ts +2 -0
  193. package/build-types/lock-unlock.d.ts.map +1 -0
  194. package/package.json +39 -39
  195. package/src/block-keyboard-shortcuts/index.js +25 -11
  196. package/src/button/index.js +1 -1
  197. package/src/comments/block.json +3 -9
  198. package/src/cover/deprecated.js +182 -4
  199. package/src/cover/edit/block-controls.js +1 -1
  200. package/src/cover/edit/cover-placeholder.js +0 -3
  201. package/src/cover/edit/index.js +42 -27
  202. package/src/cover/editor.scss +4 -5
  203. package/src/cover/index.js +8 -8
  204. package/src/cover/save.js +27 -20
  205. package/src/cover/shared.js +10 -10
  206. package/src/cover/style.scss +40 -16
  207. package/src/cover/test/__snapshots__/edit.native.js.snap +9 -9
  208. package/src/cover/test/__snapshots__/transforms.native.js.snap +4 -4
  209. package/src/cover/test/edit.js +2 -2
  210. package/src/cover/test/edit.native.js +4 -4
  211. package/src/cover/test/transforms.native.js +4 -4
  212. package/src/details/block.json +1 -0
  213. package/src/details/index.js +23 -1
  214. package/src/file/edit.js +9 -3
  215. package/src/freeform/modal.js +1 -1
  216. package/src/gallery/edit.js +1 -1
  217. package/src/group/editor.scss +0 -12
  218. package/src/heading/block.json +1 -7
  219. package/src/home-link/edit.js +27 -45
  220. package/src/home-link/index.php +0 -3
  221. package/src/image/block.json +1 -1
  222. package/src/image/edit.js +1 -1
  223. package/src/image/editor.scss +4 -0
  224. package/src/image/image.js +200 -109
  225. package/src/image/style.scss +0 -1
  226. package/src/image/test/__snapshots__/transforms.native.js.snap +1 -1
  227. package/src/latest-posts/edit.js +0 -1
  228. package/src/latest-posts/editor.scss +0 -11
  229. package/src/media-text/style.scss +1 -1
  230. package/src/media-text/test/__snapshots__/transforms.native.js.snap +2 -2
  231. package/src/navigation/edit/index.js +3 -30
  232. package/src/navigation/index.php +5 -151
  233. package/src/navigation/style.scss +1 -1
  234. package/src/navigation/use-template-part-area-label.js +10 -10
  235. package/src/page-list/block.json +14 -0
  236. package/src/page-list/style.scss +4 -0
  237. package/src/paragraph/edit.js +20 -17
  238. package/src/pattern/index.php +0 -7
  239. package/src/post-content/block.json +14 -1
  240. package/src/post-template/block.json +2 -1
  241. package/src/post-template/edit.js +19 -0
  242. package/src/query/block.json +1 -1
  243. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +3 -5
  244. package/src/query/edit/inspector-controls/index.js +2 -12
  245. package/src/query/edit/pattern-selection-modal.js +0 -3
  246. package/src/query/edit/query-content.js +9 -17
  247. package/src/query/editor.scss +0 -4
  248. package/src/query/index.php +1 -1
  249. package/src/query/test/utils.js +59 -1
  250. package/src/query/utils.js +43 -15
  251. package/src/rss/index.php +11 -8
  252. package/src/search/index.php +2 -2
  253. package/src/search/style.scss +3 -5
  254. package/src/social-link/edit.js +47 -19
  255. package/src/social-link/editor.scss +6 -7
  256. package/src/template-part/edit/advanced-controls.js +13 -13
  257. package/src/template-part/edit/index.js +1 -4
  258. package/src/template-part/edit/selection-modal.js +0 -3
  259. package/src/template-part/edit/utils/get-template-part-icon.js +20 -0
  260. package/src/template-part/edit/utils/hooks.js +2 -7
  261. package/src/template-part/variations.js +4 -16
  262. package/src/video/edit.js +1 -1
  263. package/src/video/editor.scss +9 -0
  264. package/src/video/test/__snapshots__/transforms.native.js.snap +1 -1
  265. package/src/video/tracks-editor.js +157 -141
  266. package/tsconfig.tsbuildinfo +1 -1
  267. package/build/query/edit/inspector-controls/create-new-post-link.js +0 -40
  268. package/build/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
  269. package/build-module/query/edit/inspector-controls/create-new-post-link.js +0 -33
  270. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +0 -1
  271. package/src/query/edit/inspector-controls/create-new-post-link.js +0 -32
  272. /package/src/{lock-unlock.js → lock-unlock.ts} +0 -0
@@ -2,7 +2,11 @@
2
2
  * Internal dependencies
3
3
  */
4
4
  import { terms } from './fixtures';
5
- import { getEntitiesInfo, getValueFromObjectPath } from '../utils';
5
+ import {
6
+ getEntitiesInfo,
7
+ getValueFromObjectPath,
8
+ getQueryContextFromTemplate,
9
+ } from '../utils';
6
10
 
7
11
  describe( 'Query block utils', () => {
8
12
  describe( 'getEntitiesInfo', () => {
@@ -61,4 +65,58 @@ describe( 'Query block utils', () => {
61
65
  expect( result ).toBe( 'test' );
62
66
  } );
63
67
  } );
68
+
69
+ describe( 'getQueryContextFromTemplate', () => {
70
+ it( 'should return the correct query context based on template slug', () => {
71
+ expect( getQueryContextFromTemplate() ).toStrictEqual( {
72
+ isSingular: true,
73
+ } );
74
+ expect( getQueryContextFromTemplate( '404' ) ).toStrictEqual( {
75
+ isSingular: true,
76
+ templateType: '404',
77
+ } );
78
+ expect( getQueryContextFromTemplate( 'blank' ) ).toStrictEqual( {
79
+ isSingular: true,
80
+ templateType: 'blank',
81
+ } );
82
+ expect( getQueryContextFromTemplate( 'single' ) ).toStrictEqual( {
83
+ isSingular: true,
84
+ templateType: 'single',
85
+ } );
86
+ expect(
87
+ getQueryContextFromTemplate( 'single-film' )
88
+ ).toStrictEqual( {
89
+ isSingular: true,
90
+ templateType: 'single',
91
+ } );
92
+ expect( getQueryContextFromTemplate( 'page' ) ).toStrictEqual( {
93
+ isSingular: true,
94
+ templateType: 'page',
95
+ } );
96
+ expect( getQueryContextFromTemplate( 'wp' ) ).toStrictEqual( {
97
+ isSingular: true,
98
+ templateType: 'custom',
99
+ } );
100
+ expect( getQueryContextFromTemplate( 'category' ) ).toStrictEqual( {
101
+ isSingular: false,
102
+ templateType: 'category',
103
+ } );
104
+ expect(
105
+ getQueryContextFromTemplate( 'category-dog' )
106
+ ).toStrictEqual( {
107
+ isSingular: false,
108
+ templateType: 'category',
109
+ } );
110
+ expect( getQueryContextFromTemplate( 'archive' ) ).toStrictEqual( {
111
+ isSingular: false,
112
+ templateType: 'archive',
113
+ } );
114
+ expect(
115
+ getQueryContextFromTemplate( 'archive-film' )
116
+ ).toStrictEqual( {
117
+ isSingular: false,
118
+ templateType: 'archive',
119
+ } );
120
+ } );
121
+ } );
64
122
  } );
@@ -272,32 +272,31 @@ export const getTransformedBlocksFromPattern = (
272
272
  * @return {string} The block name to be used in the patterns suggestions.
273
273
  */
274
274
  export function useBlockNameForPatterns( clientId, attributes ) {
275
- const activeVariationName = useSelect(
276
- ( select ) =>
277
- select( blocksStore ).getActiveBlockVariation(
278
- 'core/query',
279
- attributes
280
- )?.name,
281
- [ attributes ]
282
- );
283
- const blockName = `core/query/${ activeVariationName }`;
284
- const hasActiveVariationPatterns = useSelect(
275
+ return useSelect(
285
276
  ( select ) => {
277
+ const activeVariationName = select(
278
+ blocksStore
279
+ ).getActiveBlockVariation( 'core/query', attributes )?.name;
280
+
286
281
  if ( ! activeVariationName ) {
287
- return false;
282
+ return 'core/query';
288
283
  }
284
+
289
285
  const { getBlockRootClientId, getPatternsByBlockTypes } =
290
286
  select( blockEditorStore );
287
+
291
288
  const rootClientId = getBlockRootClientId( clientId );
292
289
  const activePatterns = getPatternsByBlockTypes(
293
- blockName,
290
+ `core/query/${ activeVariationName }`,
294
291
  rootClientId
295
292
  );
296
- return activePatterns.length > 0;
293
+
294
+ return activePatterns.length > 0
295
+ ? `core/query/${ activeVariationName }`
296
+ : 'core/query';
297
297
  },
298
- [ clientId, activeVariationName, blockName ]
298
+ [ clientId, attributes ]
299
299
  );
300
- return hasActiveVariationPatterns ? blockName : 'core/query';
301
300
  }
302
301
 
303
302
  /**
@@ -435,3 +434,32 @@ export const useUnsupportedBlocks = ( clientId ) => {
435
434
  [ clientId ]
436
435
  );
437
436
  };
437
+
438
+ /**
439
+ * Helper function that returns the query context from the editor based on the
440
+ * available template slug.
441
+ *
442
+ * @param {string} templateSlug Current template slug based on context.
443
+ * @return {Object} An object with isSingular and templateType properties.
444
+ */
445
+ export function getQueryContextFromTemplate( templateSlug ) {
446
+ // In the Post Editor, the template slug is not available.
447
+ if ( ! templateSlug ) {
448
+ return { isSingular: true };
449
+ }
450
+ let isSingular = false;
451
+ let templateType = templateSlug === 'wp' ? 'custom' : templateSlug;
452
+ const singularTemplates = [ '404', 'blank', 'single', 'page', 'custom' ];
453
+ const templateTypeFromSlug = templateSlug.includes( '-' )
454
+ ? templateSlug.split( '-', 1 )[ 0 ]
455
+ : templateSlug;
456
+ const queryFromTemplateSlug = templateSlug.includes( '-' )
457
+ ? templateSlug.split( '-' ).slice( 1 ).join( '-' )
458
+ : '';
459
+ if ( queryFromTemplateSlug ) {
460
+ templateType = templateTypeFromSlug;
461
+ }
462
+ isSingular = singularTemplates.includes( templateType );
463
+
464
+ return { isSingular, templateType };
465
+ }
package/src/rss/index.php CHANGED
@@ -61,17 +61,20 @@ function render_block_core_rss( $attributes ) {
61
61
  $author = $item->get_author();
62
62
  if ( is_object( $author ) ) {
63
63
  $author = $author->get_name();
64
- $author = '<span class="wp-block-rss__item-author">' . sprintf(
65
- /* translators: byline. %s: author. */
66
- __( 'by %s' ),
67
- esc_html( strip_tags( $author ) )
68
- ) . '</span>';
64
+ if ( ! empty( $author ) ) {
65
+ $author = '<span class="wp-block-rss__item-author">' . sprintf(
66
+ /* translators: byline. %s: author. */
67
+ __( 'by %s' ),
68
+ esc_html( strip_tags( $author ) )
69
+ ) . '</span>';
70
+ }
69
71
  }
70
72
  }
71
73
 
72
- $excerpt = '';
73
- if ( $attributes['displayExcerpt'] ) {
74
- $excerpt = html_entity_decode( $item->get_description(), ENT_QUOTES, get_option( 'blog_charset' ) );
74
+ $excerpt = '';
75
+ $description = $item->get_description();
76
+ if ( $attributes['displayExcerpt'] && ! empty( $description ) ) {
77
+ $excerpt = html_entity_decode( $description, ENT_QUOTES, get_option( 'blog_charset' ) );
75
78
  $excerpt = esc_attr( wp_trim_words( $excerpt, $attributes['excerptLength'], ' [&hellip;]' ) );
76
79
 
77
80
  // Change existing [...] to [&hellip;].
@@ -31,8 +31,8 @@ function render_block_core_search( $attributes ) {
31
31
 
32
32
  $input_id = wp_unique_id( 'wp-block-search__input-' );
33
33
  $classnames = classnames_for_block_core_search( $attributes );
34
- $show_label = ( ! empty( $attributes['showLabel'] ) ) ? true : false;
35
- $use_icon_button = ( ! empty( $attributes['buttonUseIcon'] ) ) ? true : false;
34
+ $show_label = ! empty( $attributes['showLabel'] );
35
+ $use_icon_button = ! empty( $attributes['buttonUseIcon'] );
36
36
  $show_button = ( ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition'] ) ? false : true;
37
37
  $button_position = $show_button ? $attributes['buttonPosition'] : null;
38
38
  $query_params = ( ! empty( $attributes['query'] ) ) ? $attributes['query'] : array();
@@ -58,11 +58,9 @@ $button-spacing-y: math.div($grid-unit-15, 2); // 6px
58
58
  // Prevent unintended text wrapping.
59
59
  flex-shrink: 0;
60
60
  max-width: 100%;
61
- }
62
-
63
- // Ensure minimum input field width in small viewports.
64
- .wp-block-search__button[aria-expanded="true"] {
65
- max-width: calc(100% - 100px);
61
+ box-sizing: border-box;
62
+ display: flex;
63
+ justify-content: center;
66
64
  }
67
65
 
68
66
  .wp-block-search__inside-wrapper {
@@ -6,7 +6,7 @@ import clsx from 'clsx';
6
6
  /**
7
7
  * WordPress dependencies
8
8
  */
9
- import { DELETE, BACKSPACE } from '@wordpress/keycodes';
9
+ import { DELETE, BACKSPACE, ENTER } from '@wordpress/keycodes';
10
10
  import { useDispatch } from '@wordpress/data';
11
11
 
12
12
  import {
@@ -16,7 +16,7 @@ import {
16
16
  useBlockProps,
17
17
  store as blockEditorStore,
18
18
  } from '@wordpress/block-editor';
19
- import { useState } from '@wordpress/element';
19
+ import { useState, useRef } from '@wordpress/element';
20
20
  import {
21
21
  Button,
22
22
  PanelBody,
@@ -24,6 +24,7 @@ import {
24
24
  TextControl,
25
25
  __experimentalInputControlSuffixWrapper as InputControlSuffixWrapper,
26
26
  } from '@wordpress/components';
27
+ import { useMergeRefs } from '@wordpress/compose';
27
28
  import { __ } from '@wordpress/i18n';
28
29
  import { keyboardReturn } from '@wordpress/icons';
29
30
 
@@ -112,12 +113,19 @@ const SocialLinkEdit = ( {
112
113
  iconBackgroundColorValue,
113
114
  } = context;
114
115
  const [ showURLPopover, setPopover ] = useState( false );
115
- const classes = clsx( 'wp-social-link', 'wp-social-link-' + service, {
116
- 'wp-social-link__is-incomplete': ! url,
117
- [ `has-${ iconColor }-color` ]: iconColor,
118
- [ `has-${ iconBackgroundColor }-background-color` ]:
119
- iconBackgroundColor,
120
- } );
116
+ const wrapperClasses = clsx(
117
+ 'wp-social-link',
118
+ // Manually adding this class for backwards compatibility of CSS when moving the
119
+ // blockProps from the li to the button: https://github.com/WordPress/gutenberg/pull/64883
120
+ 'wp-block-social-link',
121
+ 'wp-social-link-' + service,
122
+ {
123
+ 'wp-social-link__is-incomplete': ! url,
124
+ [ `has-${ iconColor }-color` ]: iconColor,
125
+ [ `has-${ iconBackgroundColor }-background-color` ]:
126
+ iconBackgroundColor,
127
+ }
128
+ );
121
129
 
122
130
  // Use internal state instead of a ref to make sure that the component
123
131
  // re-renders when the popover's anchor updates.
@@ -131,11 +139,16 @@ const SocialLinkEdit = ( {
131
139
  // spaces. The PHP render callback fallbacks to the social name as well.
132
140
  const socialLinkText = label.trim() === '' ? socialLinkName : label;
133
141
 
142
+ const ref = useRef();
134
143
  const blockProps = useBlockProps( {
135
- className: classes,
136
- style: {
137
- color: iconColorValue,
138
- backgroundColor: iconBackgroundColorValue,
144
+ className: 'wp-block-social-link-anchor',
145
+ ref: useMergeRefs( [ setPopoverAnchor, ref ] ),
146
+ onClick: () => setPopover( true ),
147
+ onKeyDown: ( event ) => {
148
+ if ( event.keyCode === ENTER ) {
149
+ event.preventDefault();
150
+ setPopover( true );
151
+ }
139
152
  },
140
153
  } );
141
154
 
@@ -169,13 +182,27 @@ const SocialLinkEdit = ( {
169
182
  onChange={ ( value ) => setAttributes( { rel: value } ) }
170
183
  />
171
184
  </InspectorControls>
172
- <li { ...blockProps }>
173
- <button
174
- className="wp-block-social-link-anchor"
175
- ref={ setPopoverAnchor }
176
- onClick={ () => setPopover( true ) }
177
- aria-haspopup="dialog"
178
- >
185
+ { /*
186
+ * Because the `<ul>` element has a role=document, the `<li>` is
187
+ * not semantically correct, so adding role=presentation is cleaner.
188
+ * https://github.com/WordPress/gutenberg/pull/64883#issuecomment-2472874551
189
+ */ }
190
+ <li
191
+ role="presentation"
192
+ className={ wrapperClasses }
193
+ style={ {
194
+ color: iconColorValue,
195
+ backgroundColor: iconBackgroundColorValue,
196
+ } }
197
+ >
198
+ { /*
199
+ * Disable reason: The `button` ARIA role is redundant but
200
+ * blockProps has a role of `document` automatically applied
201
+ * which breaks the semantics of this button since it removes
202
+ * the information about the popover.
203
+ */
204
+ /* eslint-disable jsx-a11y/no-redundant-roles */ }
205
+ <button aria-haspopup="dialog" { ...blockProps } role="button">
179
206
  <IconComponent />
180
207
  <span
181
208
  className={ clsx( 'wp-block-social-link-label', {
@@ -185,6 +212,7 @@ const SocialLinkEdit = ( {
185
212
  { socialLinkText }
186
213
  </span>
187
214
  </button>
215
+ { /* eslint-enable jsx-a11y/no-redundant-roles */ }
188
216
  { isSelected && showURLPopover && (
189
217
  <SocialLinkURLPopover
190
218
  url={ url }
@@ -14,6 +14,8 @@
14
14
  font-size: inherit;
15
15
  color: currentColor;
16
16
  height: auto;
17
+ font-weight: inherit;
18
+ font-family: inherit;
17
19
 
18
20
  // This rule ensures social link buttons display correctly in template parts.
19
21
  opacity: 1;
@@ -21,13 +23,10 @@
21
23
  // This rule is duplicated from the style.scss and needs to be the same as there.
22
24
  padding: 0.25em;
23
25
 
24
- // Focus styles replicate the `@wordpress/components` button component.
25
- &:focus:not(:disabled) {
26
- border-radius: 2px;
27
- box-shadow: 0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);
28
-
29
- // Windows High Contrast mode will show this outline, but not the box-shadow.
30
- outline: 3px solid transparent;
26
+ // Override the shared `.wp-block-social-link` class used on both the li and button
27
+ // due to backwards compatibility from moving the blockProps from the li to the button.
28
+ &:hover {
29
+ transform: none;
31
30
  }
32
31
  }
33
32
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * WordPress dependencies
3
3
  */
4
- import { useEntityProp } from '@wordpress/core-data';
4
+ import { useEntityProp, store as coreStore } from '@wordpress/core-data';
5
5
  import { SelectControl, TextControl } from '@wordpress/components';
6
6
  import { sprintf, __ } from '@wordpress/i18n';
7
7
  import { useSelect } from '@wordpress/data';
@@ -54,19 +54,19 @@ export function TemplatePartAdvancedControls( {
54
54
  templatePartId
55
55
  );
56
56
 
57
- const definedAreas = useSelect( ( select ) => {
58
- // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
59
- // Blocks can be loaded into a *non-post* block editor.
60
- /* eslint-disable-next-line @wordpress/data-no-store-string-literals */
61
- return select(
62
- 'core/editor'
63
- ).__experimentalGetDefaultTemplatePartAreas();
64
- }, [] );
57
+ const defaultTemplatePartAreas = useSelect(
58
+ ( select ) =>
59
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
60
+ ?.default_template_part_areas || [],
61
+ []
62
+ );
65
63
 
66
- const areaOptions = definedAreas.map( ( { label, area: _area } ) => ( {
67
- label,
68
- value: _area,
69
- } ) );
64
+ const areaOptions = defaultTemplatePartAreas.map(
65
+ ( { label, area: _area } ) => ( {
66
+ label,
67
+ value: _area,
68
+ } )
69
+ );
70
70
 
71
71
  return (
72
72
  <>
@@ -21,7 +21,6 @@ import {
21
21
  MenuItem,
22
22
  ToolbarButton,
23
23
  } from '@wordpress/components';
24
- import { useAsyncList } from '@wordpress/compose';
25
24
  import { __, sprintf } from '@wordpress/i18n';
26
25
  import { store as coreStore } from '@wordpress/core-data';
27
26
  import { useState } from '@wordpress/element';
@@ -85,7 +84,6 @@ function TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {
85
84
  isEntityAvailable &&
86
85
  !! blockPatterns.length &&
87
86
  ( area === 'header' || area === 'footer' );
88
- const shownTemplates = useAsyncList( blockPatterns );
89
87
 
90
88
  if ( ! canReplace ) {
91
89
  return null;
@@ -96,9 +94,8 @@ function TemplatesList( { area, clientId, isEntityAvailable, onSelect } ) {
96
94
  <BlockPatternsList
97
95
  label={ __( 'Templates' ) }
98
96
  blockPatterns={ blockPatterns }
99
- shownPatterns={ shownTemplates }
100
97
  onClickPattern={ onSelect }
101
- showTitle={ false }
98
+ showTitlesAsTooltip
102
99
  />
103
100
  </PanelBody>
104
101
  );
@@ -5,7 +5,6 @@ import { useMemo, useState } from '@wordpress/element';
5
5
  import { __, sprintf } from '@wordpress/i18n';
6
6
  import { store as noticesStore } from '@wordpress/notices';
7
7
  import { useDispatch } from '@wordpress/data';
8
- import { useAsyncList } from '@wordpress/compose';
9
8
  import { __experimentalBlockPatternsList as BlockPatternsList } from '@wordpress/block-editor';
10
9
  import {
11
10
  SearchControl,
@@ -43,7 +42,6 @@ export default function TemplatePartSelectionModal( {
43
42
 
44
43
  return searchPatterns( partsAsPatterns, searchValue );
45
44
  }, [ templateParts, searchValue ] );
46
- const shownTemplateParts = useAsyncList( filteredTemplateParts );
47
45
  const blockPatterns = useAlternativeBlockPatterns( area, clientId );
48
46
  const filteredBlockPatterns = useMemo( () => {
49
47
  return searchPatterns( blockPatterns, searchValue );
@@ -89,7 +87,6 @@ export default function TemplatePartSelectionModal( {
89
87
  <h2>{ __( 'Existing template parts' ) }</h2>
90
88
  <BlockPatternsList
91
89
  blockPatterns={ filteredTemplateParts }
92
- shownPatterns={ shownTemplateParts }
93
90
  onClickPattern={ ( pattern ) => {
94
91
  onTemplatePartSelect( pattern.templatePart );
95
92
  } }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import {
5
+ header as headerIcon,
6
+ footer as footerIcon,
7
+ sidebar as sidebarIcon,
8
+ symbolFilled as symbolFilledIcon,
9
+ } from '@wordpress/icons';
10
+
11
+ export const getTemplatePartIcon = ( iconName ) => {
12
+ if ( 'header' === iconName ) {
13
+ return headerIcon;
14
+ } else if ( 'footer' === iconName ) {
15
+ return footerIcon;
16
+ } else if ( 'sidebar' === iconName ) {
17
+ return sidebarIcon;
18
+ }
19
+ return symbolFilledIcon;
20
+ };
@@ -136,14 +136,9 @@ export function useCreateTemplatePartFromBlocks( area, setAttributes ) {
136
136
  export function useTemplatePartArea( area ) {
137
137
  return useSelect(
138
138
  ( select ) => {
139
- // FIXME: @wordpress/block-library should not depend on @wordpress/editor.
140
- // Blocks can be loaded into a *non-post* block editor.
141
- /* eslint-disable @wordpress/data-no-store-string-literals */
142
139
  const definedAreas =
143
- select(
144
- 'core/editor'
145
- ).__experimentalGetDefaultTemplatePartAreas();
146
- /* eslint-enable @wordpress/data-no-store-string-literals */
140
+ select( coreStore ).getEntityRecord( 'root', '__unstableBase' )
141
+ ?.default_template_part_areas || [];
147
142
 
148
143
  const selectedArea = definedAreas.find(
149
144
  ( definedArea ) => definedArea.area === area
@@ -3,23 +3,11 @@
3
3
  */
4
4
  import { store as coreDataStore } from '@wordpress/core-data';
5
5
  import { select } from '@wordpress/data';
6
- import {
7
- header as headerIcon,
8
- footer as footerIcon,
9
- sidebar as sidebarIcon,
10
- symbolFilled as symbolFilledIcon,
11
- } from '@wordpress/icons';
12
6
 
13
- function getTemplatePartIcon( iconName ) {
14
- if ( 'header' === iconName ) {
15
- return headerIcon;
16
- } else if ( 'footer' === iconName ) {
17
- return footerIcon;
18
- } else if ( 'sidebar' === iconName ) {
19
- return sidebarIcon;
20
- }
21
- return symbolFilledIcon;
22
- }
7
+ /**
8
+ * Internal dependencies
9
+ */
10
+ import { getTemplatePartIcon } from './edit/utils/get-template-part-icon';
23
11
 
24
12
  export function enhanceTemplatePartVariations( settings, name ) {
25
13
  if ( name !== 'core/template-part' ) {
package/src/video/edit.js CHANGED
@@ -141,7 +141,7 @@ function VideoEdit( {
141
141
  icon={ icon }
142
142
  label={ __( 'Video' ) }
143
143
  instructions={ __(
144
- 'Upload a video file, pick one from your media library, or add one with a URL.'
144
+ 'Drag and drop a video, upload, or choose from your library.'
145
145
  ) }
146
146
  >
147
147
  { content }
@@ -37,6 +37,7 @@
37
37
  max-width: 240px;
38
38
  }
39
39
 
40
+ .block-library-video-tracks-editor__tracks-informative-message-title,
40
41
  .block-library-video-tracks-editor__single-track-editor-edit-track-label {
41
42
  margin-top: $grid-unit-05;
42
43
  color: $gray-700;
@@ -56,3 +57,11 @@
56
57
  padding: 0;
57
58
  }
58
59
  }
60
+
61
+ .block-library-video-tracks-editor__tracks-informative-message {
62
+ padding: $grid-unit-10;
63
+
64
+ &-description {
65
+ margin-bottom: 0;
66
+ }
67
+ }
@@ -12,7 +12,7 @@ exports[`Video block transforms to Columns block 1`] = `
12
12
 
13
13
  exports[`Video block transforms to Cover block 1`] = `
14
14
  "<!-- wp:cover {"url":"https://i.cloudup.com/YtZFJbuQCE.mov","dimRatio":50,"backgroundType":"video"} -->
15
- <div class="wp-block-cover"><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" data-object-fit="cover"></video><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
15
+ <div class="wp-block-cover"><video class="wp-block-cover__video-background intrinsic-ignore" autoplay muted loop playsinline src="https://i.cloudup.com/YtZFJbuQCE.mov" data-object-fit="cover"></video><span aria-hidden="true" class="wp-block-cover__background has-background-dim"></span><div class="wp-block-cover__inner-container"><!-- wp:paragraph {"align":"center","fontSize":"large"} -->
16
16
  <p class="has-text-align-center has-large-font-size">Cloudup video</p>
17
17
  <!-- /wp:paragraph --></div></div>
18
18
  <!-- /wp:cover -->"