@wordpress/block-library 9.26.0 → 9.27.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 (174) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/button/edit.js +1 -1
  3. package/build/button/edit.js.map +1 -1
  4. package/build/cover/edit/block-controls.js +4 -2
  5. package/build/cover/edit/block-controls.js.map +1 -1
  6. package/build/cover/edit/index.js +6 -3
  7. package/build/cover/edit/index.js.map +1 -1
  8. package/build/cover/edit/inspector-controls.js +11 -4
  9. package/build/cover/edit/inspector-controls.js.map +1 -1
  10. package/build/cover/edit/poster-image.js +81 -0
  11. package/build/cover/edit/poster-image.js.map +1 -0
  12. package/build/cover/index.js +6 -0
  13. package/build/cover/index.js.map +1 -1
  14. package/build/cover/save.js +3 -1
  15. package/build/cover/save.js.map +1 -1
  16. package/build/details/index.js +1 -1
  17. package/build/details/index.js.map +1 -1
  18. package/build/gallery/constants.js +2 -1
  19. package/build/gallery/constants.js.map +1 -1
  20. package/build/gallery/edit.js +93 -15
  21. package/build/gallery/edit.js.map +1 -1
  22. package/build/image/edit.js +6 -0
  23. package/build/image/edit.js.map +1 -1
  24. package/build/list/index.js +0 -1
  25. package/build/list/index.js.map +1 -1
  26. package/build/media-text/edit.js +2 -2
  27. package/build/media-text/edit.js.map +1 -1
  28. package/build/more/edit.native.js +17 -32
  29. package/build/more/edit.native.js.map +1 -1
  30. package/build/navigation-link/edit.js +49 -16
  31. package/build/navigation-link/edit.js.map +1 -1
  32. package/build/navigation-link/update-attributes.js +112 -14
  33. package/build/navigation-link/update-attributes.js.map +1 -1
  34. package/build/navigation-submenu/edit.js +19 -2
  35. package/build/navigation-submenu/edit.js.map +1 -1
  36. package/build/post-author/edit.js +78 -35
  37. package/build/post-author/edit.js.map +1 -1
  38. package/build/post-comments-form/form.js +1 -1
  39. package/build/post-comments-form/form.js.map +1 -1
  40. package/build/post-content/edit.js +78 -16
  41. package/build/post-content/edit.js.map +1 -1
  42. package/build/post-content/index.js +6 -0
  43. package/build/post-content/index.js.map +1 -1
  44. package/build/post-featured-image/edit.js +2 -1
  45. package/build/post-featured-image/edit.js.map +1 -1
  46. package/build/search/edit.js +1 -1
  47. package/build/search/edit.js.map +1 -1
  48. package/build/separator/edit.js +5 -30
  49. package/build/separator/edit.js.map +1 -1
  50. package/build/site-logo/edit.js +16 -5
  51. package/build/site-logo/edit.js.map +1 -1
  52. package/build/site-tagline/index.js +1 -1
  53. package/build/video/edit.js +2 -5
  54. package/build/video/edit.js.map +1 -1
  55. package/build/video/poster-image.js +25 -25
  56. package/build/video/poster-image.js.map +1 -1
  57. package/build/video/tracks-editor.js +95 -104
  58. package/build/video/tracks-editor.js.map +1 -1
  59. package/build/video/tracks.js +6 -2
  60. package/build/video/tracks.js.map +1 -1
  61. package/build-module/button/edit.js +1 -1
  62. package/build-module/button/edit.js.map +1 -1
  63. package/build-module/cover/edit/block-controls.js +4 -2
  64. package/build-module/cover/edit/block-controls.js.map +1 -1
  65. package/build-module/cover/edit/index.js +6 -3
  66. package/build-module/cover/edit/index.js.map +1 -1
  67. package/build-module/cover/edit/inspector-controls.js +10 -4
  68. package/build-module/cover/edit/inspector-controls.js.map +1 -1
  69. package/build-module/cover/edit/poster-image.js +74 -0
  70. package/build-module/cover/edit/poster-image.js.map +1 -0
  71. package/build-module/cover/index.js +6 -0
  72. package/build-module/cover/index.js.map +1 -1
  73. package/build-module/cover/save.js +3 -1
  74. package/build-module/cover/save.js.map +1 -1
  75. package/build-module/details/index.js +1 -1
  76. package/build-module/details/index.js.map +1 -1
  77. package/build-module/gallery/constants.js +1 -0
  78. package/build-module/gallery/constants.js.map +1 -1
  79. package/build-module/gallery/edit.js +95 -17
  80. package/build-module/gallery/edit.js.map +1 -1
  81. package/build-module/image/edit.js +6 -0
  82. package/build-module/image/edit.js.map +1 -1
  83. package/build-module/list/index.js +0 -1
  84. package/build-module/list/index.js.map +1 -1
  85. package/build-module/media-text/edit.js +2 -2
  86. package/build-module/media-text/edit.js.map +1 -1
  87. package/build-module/more/edit.native.js +16 -30
  88. package/build-module/more/edit.native.js.map +1 -1
  89. package/build-module/navigation-link/edit.js +50 -17
  90. package/build-module/navigation-link/edit.js.map +1 -1
  91. package/build-module/navigation-link/update-attributes.js +113 -15
  92. package/build-module/navigation-link/update-attributes.js.map +1 -1
  93. package/build-module/navigation-submenu/edit.js +20 -3
  94. package/build-module/navigation-submenu/edit.js.map +1 -1
  95. package/build-module/post-author/edit.js +78 -35
  96. package/build-module/post-author/edit.js.map +1 -1
  97. package/build-module/post-comments-form/form.js +1 -1
  98. package/build-module/post-comments-form/form.js.map +1 -1
  99. package/build-module/post-content/edit.js +80 -18
  100. package/build-module/post-content/edit.js.map +1 -1
  101. package/build-module/post-content/index.js +6 -0
  102. package/build-module/post-content/index.js.map +1 -1
  103. package/build-module/post-featured-image/edit.js +2 -1
  104. package/build-module/post-featured-image/edit.js.map +1 -1
  105. package/build-module/search/edit.js +1 -1
  106. package/build-module/search/edit.js.map +1 -1
  107. package/build-module/separator/edit.js +6 -31
  108. package/build-module/separator/edit.js.map +1 -1
  109. package/build-module/site-logo/edit.js +17 -6
  110. package/build-module/site-logo/edit.js.map +1 -1
  111. package/build-module/site-tagline/index.js +1 -1
  112. package/build-module/video/edit.js +2 -5
  113. package/build-module/video/edit.js.map +1 -1
  114. package/build-module/video/poster-image.js +26 -26
  115. package/build-module/video/poster-image.js.map +1 -1
  116. package/build-module/video/tracks-editor.js +96 -105
  117. package/build-module/video/tracks-editor.js.map +1 -1
  118. package/build-module/video/tracks.js +6 -2
  119. package/build-module/video/tracks.js.map +1 -1
  120. package/build-style/archives/editor-rtl.css +0 -4
  121. package/build-style/archives/editor.css +0 -4
  122. package/build-style/editor-rtl.css +0 -21
  123. package/build-style/editor.css +0 -21
  124. package/build-style/file/style-rtl.css +1 -1
  125. package/build-style/file/style.css +1 -1
  126. package/build-style/gallery/editor-rtl.css +0 -13
  127. package/build-style/gallery/editor.css +0 -13
  128. package/build-style/navigation/style-rtl.css +2 -0
  129. package/build-style/navigation/style.css +2 -0
  130. package/build-style/style-rtl.css +3 -1
  131. package/build-style/style.css +3 -1
  132. package/build-style/video/editor-rtl.css +0 -4
  133. package/build-style/video/editor.css +0 -4
  134. package/package.json +35 -35
  135. package/src/archives/editor.scss +0 -4
  136. package/src/button/edit.js +1 -1
  137. package/src/comments-pagination/index.php +7 -2
  138. package/src/cover/block.json +6 -0
  139. package/src/cover/edit/block-controls.js +22 -17
  140. package/src/cover/edit/index.js +4 -1
  141. package/src/cover/edit/inspector-controls.js +12 -3
  142. package/src/cover/edit/poster-image.js +91 -0
  143. package/src/cover/save.js +2 -0
  144. package/src/details/index.js +1 -1
  145. package/src/file/style.scss +1 -1
  146. package/src/gallery/constants.js +1 -0
  147. package/src/gallery/edit.js +182 -68
  148. package/src/gallery/editor.scss +0 -17
  149. package/src/image/edit.js +12 -0
  150. package/src/list/block.json +0 -1
  151. package/src/media-text/edit.js +1 -1
  152. package/src/more/edit.native.js +19 -33
  153. package/src/navigation/style.scss +2 -0
  154. package/src/navigation-link/edit.js +46 -17
  155. package/src/navigation-link/test/edit.js +738 -6
  156. package/src/navigation-link/update-attributes.js +125 -12
  157. package/src/navigation-submenu/edit.js +21 -1
  158. package/src/post-author/edit.js +91 -40
  159. package/src/post-comments-form/form.js +1 -1
  160. package/src/post-content/block.json +6 -0
  161. package/src/post-content/edit.js +71 -19
  162. package/src/post-content/index.php +11 -4
  163. package/src/post-featured-image/edit.js +1 -0
  164. package/src/post-featured-image/index.php +3 -2
  165. package/src/rss/index.php +2 -1
  166. package/src/search/edit.js +1 -1
  167. package/src/separator/edit.js +8 -43
  168. package/src/site-logo/edit.js +22 -10
  169. package/src/site-tagline/block.json +1 -1
  170. package/src/video/edit.js +1 -4
  171. package/src/video/editor.scss +0 -6
  172. package/src/video/poster-image.js +29 -24
  173. package/src/video/tracks-editor.js +93 -103
  174. package/src/video/tracks.js +2 -1
@@ -164,6 +164,7 @@
164
164
  }
165
165
  .wp-block-navigation .wp-block-navigation-item__content {
166
166
  display: block;
167
+ z-index: 1;
167
168
  }
168
169
  .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
169
170
  color: inherit;
@@ -254,6 +255,7 @@
254
255
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content {
255
256
  display: flex;
256
257
  flex-grow: 1;
258
+ padding: 0.5em 1em;
257
259
  }
258
260
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon {
259
261
  margin-left: 0;
@@ -164,6 +164,7 @@
164
164
  }
165
165
  .wp-block-navigation .wp-block-navigation-item__content {
166
166
  display: block;
167
+ z-index: 1;
167
168
  }
168
169
  .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
169
170
  color: inherit;
@@ -254,6 +255,7 @@
254
255
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content {
255
256
  display: flex;
256
257
  flex-grow: 1;
258
+ padding: 0.5em 1em;
257
259
  }
258
260
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon {
259
261
  margin-right: 0;
@@ -1180,7 +1180,7 @@ body:not(.editor-styles-wrapper) .wp-block-cover:not(.wp-block-cover:has(.wp-blo
1180
1180
  padding: 0.5em 1em;
1181
1181
  display: inline-block;
1182
1182
  }
1183
- :where(.wp-block-file__button):is(a):hover, :where(.wp-block-file__button):is(a):visited, :where(.wp-block-file__button):is(a):focus, :where(.wp-block-file__button):is(a):active {
1183
+ :where(.wp-block-file__button):where(a):hover, :where(.wp-block-file__button):where(a):visited, :where(.wp-block-file__button):where(a):focus, :where(.wp-block-file__button):where(a):active {
1184
1184
  box-shadow: none;
1185
1185
  color: #fff;
1186
1186
  opacity: 0.85;
@@ -2282,6 +2282,7 @@ ul {
2282
2282
  }
2283
2283
  .wp-block-navigation .wp-block-navigation-item__content {
2284
2284
  display: block;
2285
+ z-index: 1;
2285
2286
  }
2286
2287
  .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
2287
2288
  color: inherit;
@@ -2372,6 +2373,7 @@ ul {
2372
2373
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content {
2373
2374
  display: flex;
2374
2375
  flex-grow: 1;
2376
+ padding: 0.5em 1em;
2375
2377
  }
2376
2378
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon {
2377
2379
  margin-left: 0;
@@ -1188,7 +1188,7 @@ body:not(.editor-styles-wrapper) .wp-block-cover:not(.wp-block-cover:has(.wp-blo
1188
1188
  padding: 0.5em 1em;
1189
1189
  display: inline-block;
1190
1190
  }
1191
- :where(.wp-block-file__button):is(a):hover, :where(.wp-block-file__button):is(a):visited, :where(.wp-block-file__button):is(a):focus, :where(.wp-block-file__button):is(a):active {
1191
+ :where(.wp-block-file__button):where(a):hover, :where(.wp-block-file__button):where(a):visited, :where(.wp-block-file__button):where(a):focus, :where(.wp-block-file__button):where(a):active {
1192
1192
  box-shadow: none;
1193
1193
  color: #fff;
1194
1194
  opacity: 0.85;
@@ -2312,6 +2312,7 @@ ul {
2312
2312
  }
2313
2313
  .wp-block-navigation .wp-block-navigation-item__content {
2314
2314
  display: block;
2315
+ z-index: 1;
2315
2316
  }
2316
2317
  .wp-block-navigation .wp-block-navigation-item__content.wp-block-navigation-item__content {
2317
2318
  color: inherit;
@@ -2402,6 +2403,7 @@ ul {
2402
2403
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content {
2403
2404
  display: flex;
2404
2405
  flex-grow: 1;
2406
+ padding: 0.5em 1em;
2405
2407
  }
2406
2408
  .wp-block-navigation .has-child .wp-block-navigation__submenu-container > .wp-block-navigation-item > .wp-block-navigation-item__content .wp-block-navigation__submenu-icon {
2407
2409
  margin-right: 0;
@@ -152,10 +152,6 @@
152
152
  margin-right: -9px;
153
153
  }
154
154
 
155
- .editor-video-poster-control .components-button {
156
- margin-left: 8px;
157
- }
158
-
159
155
  .block-library-video-tracks-editor {
160
156
  z-index: 159990;
161
157
  }
@@ -152,10 +152,6 @@
152
152
  margin-left: -9px;
153
153
  }
154
154
 
155
- .editor-video-poster-control .components-button {
156
- margin-right: 8px;
157
- }
158
-
159
155
  .block-library-video-tracks-editor {
160
156
  z-index: 159990;
161
157
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wordpress/block-library",
3
- "version": "9.26.0",
3
+ "version": "9.27.0",
4
4
  "description": "Block library for the WordPress editor.",
5
5
  "author": "The WordPress Contributors",
6
6
  "license": "GPL-2.0-or-later",
@@ -41,39 +41,39 @@
41
41
  ],
42
42
  "dependencies": {
43
43
  "@babel/runtime": "7.25.7",
44
- "@wordpress/a11y": "^4.26.0",
45
- "@wordpress/api-fetch": "^7.26.0",
46
- "@wordpress/autop": "^4.26.0",
47
- "@wordpress/blob": "^4.26.0",
48
- "@wordpress/block-editor": "^14.21.0",
49
- "@wordpress/blocks": "^14.15.0",
50
- "@wordpress/components": "^29.12.0",
51
- "@wordpress/compose": "^7.26.0",
52
- "@wordpress/core-data": "^7.26.0",
53
- "@wordpress/data": "^10.26.0",
54
- "@wordpress/date": "^5.26.0",
55
- "@wordpress/deprecated": "^4.26.0",
56
- "@wordpress/dom": "^4.26.0",
57
- "@wordpress/element": "^6.26.0",
58
- "@wordpress/escape-html": "^3.26.0",
59
- "@wordpress/hooks": "^4.26.0",
60
- "@wordpress/html-entities": "^4.26.0",
61
- "@wordpress/i18n": "^5.26.0",
62
- "@wordpress/icons": "^10.26.0",
63
- "@wordpress/interactivity": "^6.26.0",
64
- "@wordpress/interactivity-router": "^2.26.0",
65
- "@wordpress/keyboard-shortcuts": "^5.26.0",
66
- "@wordpress/keycodes": "^4.26.0",
67
- "@wordpress/notices": "^5.26.0",
68
- "@wordpress/patterns": "^2.26.0",
69
- "@wordpress/primitives": "^4.26.0",
70
- "@wordpress/private-apis": "^1.26.0",
71
- "@wordpress/reusable-blocks": "^5.26.0",
72
- "@wordpress/rich-text": "^7.26.0",
73
- "@wordpress/server-side-render": "^6.2.0",
74
- "@wordpress/url": "^4.26.0",
75
- "@wordpress/viewport": "^6.26.0",
76
- "@wordpress/wordcount": "^4.26.0",
44
+ "@wordpress/a11y": "^4.27.0",
45
+ "@wordpress/api-fetch": "^7.27.0",
46
+ "@wordpress/autop": "^4.27.0",
47
+ "@wordpress/blob": "^4.27.0",
48
+ "@wordpress/block-editor": "^15.0.0",
49
+ "@wordpress/blocks": "^15.0.0",
50
+ "@wordpress/components": "^30.0.0",
51
+ "@wordpress/compose": "^7.27.0",
52
+ "@wordpress/core-data": "^7.27.0",
53
+ "@wordpress/data": "^10.27.0",
54
+ "@wordpress/date": "^5.27.0",
55
+ "@wordpress/deprecated": "^4.27.0",
56
+ "@wordpress/dom": "^4.27.0",
57
+ "@wordpress/element": "^6.27.0",
58
+ "@wordpress/escape-html": "^3.27.0",
59
+ "@wordpress/hooks": "^4.27.0",
60
+ "@wordpress/html-entities": "^4.27.0",
61
+ "@wordpress/i18n": "^6.0.0",
62
+ "@wordpress/icons": "^10.27.0",
63
+ "@wordpress/interactivity": "^6.27.0",
64
+ "@wordpress/interactivity-router": "^2.27.0",
65
+ "@wordpress/keyboard-shortcuts": "^5.27.0",
66
+ "@wordpress/keycodes": "^4.27.0",
67
+ "@wordpress/notices": "^5.27.0",
68
+ "@wordpress/patterns": "^2.27.0",
69
+ "@wordpress/primitives": "^4.27.0",
70
+ "@wordpress/private-apis": "^1.27.0",
71
+ "@wordpress/reusable-blocks": "^5.27.0",
72
+ "@wordpress/rich-text": "^7.27.0",
73
+ "@wordpress/server-side-render": "^6.3.0",
74
+ "@wordpress/url": "^4.27.0",
75
+ "@wordpress/viewport": "^6.27.0",
76
+ "@wordpress/wordcount": "^4.27.0",
77
77
  "change-case": "^4.1.2",
78
78
  "clsx": "^2.1.1",
79
79
  "colord": "^2.7.0",
@@ -91,5 +91,5 @@
91
91
  "publishConfig": {
92
92
  "access": "public"
93
93
  },
94
- "gitHead": "35e26942820d8237771af0c58e45b4303f0497f1"
94
+ "gitHead": "abe06a6f2aef8d03c30ea9d5b3e133f041e523b1"
95
95
  }
@@ -1,7 +1,3 @@
1
- ul.wp-block-archives {
2
- padding-left: 2.5em;
3
- }
4
-
5
1
  // The following styles are to prevent duplicate spacing and borders for the archives
6
2
  // block in the editor given it uses server side rendering.
7
3
  // See https://github.com/WordPress/gutenberg/pull/63400
@@ -159,7 +159,7 @@ function WidthPanel( { selectedWidth, setAttributes } ) {
159
159
  key={ widthValue }
160
160
  value={ widthValue }
161
161
  label={ sprintf(
162
- /* translators: Percentage value. */
162
+ /* translators: %d: Percentage value. */
163
163
  __( '%d%%' ),
164
164
  widthValue
165
165
  ) }
@@ -25,10 +25,15 @@ function render_block_core_comments_pagination( $attributes, $content ) {
25
25
  }
26
26
 
27
27
  $classes = ( isset( $attributes['style']['elements']['link']['color']['text'] ) ) ? 'has-link-color' : '';
28
- $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
28
+ $wrapper_attributes = get_block_wrapper_attributes(
29
+ array(
30
+ 'aria-label' => __( 'Comments pagination' ),
31
+ 'class' => $classes,
32
+ )
33
+ );
29
34
 
30
35
  return sprintf(
31
- '<div %1$s>%2$s</div>',
36
+ '<nav %1$s>%2$s</nav>',
32
37
  $wrapper_attributes,
33
38
  $content
34
39
  );
@@ -81,6 +81,12 @@
81
81
  },
82
82
  "sizeSlug": {
83
83
  "type": "string"
84
+ },
85
+ "poster": {
86
+ "type": "string",
87
+ "source": "attribute",
88
+ "selector": "video",
89
+ "attribute": "poster"
84
90
  }
85
91
  },
86
92
  "usesContext": [ "postId", "postType" ],
@@ -27,6 +27,7 @@ export default function CoverBlockControls( {
27
27
  currentSettings,
28
28
  toggleUseFeaturedImage,
29
29
  onClearMedia,
30
+ blockEditingMode,
30
31
  } ) {
31
32
  const { contentPosition, id, useFeaturedImage, minHeight, minHeightUnit } =
32
33
  attributes;
@@ -39,6 +40,8 @@ export default function CoverBlockControls( {
39
40
  minHeightUnit === 'vh' &&
40
41
  minHeight === 100 &&
41
42
  ! attributes?.style?.dimensions?.aspectRatio;
43
+ const isContentOnlyMode = blockEditingMode === 'contentOnly';
44
+
42
45
  const toggleMinFullHeight = () => {
43
46
  if ( isMinFullHeight ) {
44
47
  // If there aren't previous values, take the default ones.
@@ -75,23 +78,25 @@ export default function CoverBlockControls( {
75
78
 
76
79
  return (
77
80
  <>
78
- <BlockControls group="block">
79
- <BlockAlignmentMatrixControl
80
- label={ __( 'Change content position' ) }
81
- value={ contentPosition }
82
- onChange={ ( nextPosition ) =>
83
- setAttributes( {
84
- contentPosition: nextPosition,
85
- } )
86
- }
87
- isDisabled={ ! hasInnerBlocks }
88
- />
89
- <FullHeightAlignmentControl
90
- isActive={ isMinFullHeight }
91
- onToggle={ toggleMinFullHeight }
92
- isDisabled={ ! hasInnerBlocks }
93
- />
94
- </BlockControls>
81
+ { ! isContentOnlyMode && (
82
+ <BlockControls group="block">
83
+ <BlockAlignmentMatrixControl
84
+ label={ __( 'Change content position' ) }
85
+ value={ contentPosition }
86
+ onChange={ ( nextPosition ) =>
87
+ setAttributes( {
88
+ contentPosition: nextPosition,
89
+ } )
90
+ }
91
+ isDisabled={ ! hasInnerBlocks }
92
+ />
93
+ <FullHeightAlignmentControl
94
+ isActive={ isMinFullHeight }
95
+ onToggle={ toggleMinFullHeight }
96
+ isDisabled={ ! hasInnerBlocks }
97
+ />
98
+ </BlockControls>
99
+ ) }
95
100
  <BlockControls group="other">
96
101
  <MediaReplaceFlow
97
102
  mediaId={ id }
@@ -102,6 +102,7 @@ function CoverEdit( {
102
102
  tagName: TagName = 'div',
103
103
  isUserOverlayColor,
104
104
  sizeSlug,
105
+ poster,
105
106
  } = attributes;
106
107
 
107
108
  const [ featuredImage ] = useEntityProp(
@@ -324,7 +325,7 @@ function CoverEdit( {
324
325
  const [ resizeListener, { height, width } ] = useResizeObserver();
325
326
  const resizableBoxDimensions = useMemo( () => {
326
327
  return {
327
- height: minHeightUnit === 'px' ? minHeight : 'auto',
328
+ height: minHeightUnit === 'px' && minHeight ? minHeight : 'auto',
328
329
  width: 'auto',
329
330
  };
330
331
  }, [ minHeight, minHeightUnit ] );
@@ -446,6 +447,7 @@ function CoverEdit( {
446
447
  currentSettings={ currentSettings }
447
448
  toggleUseFeaturedImage={ toggleUseFeaturedImage }
448
449
  onClearMedia={ onClearMedia }
450
+ blockEditingMode={ blockEditingMode }
449
451
  />
450
452
  );
451
453
 
@@ -589,6 +591,7 @@ function CoverEdit( {
589
591
  muted
590
592
  loop
591
593
  src={ url }
594
+ poster={ poster }
592
595
  style={ mediaStyle }
593
596
  />
594
597
  ) }
@@ -35,6 +35,7 @@ import { COVER_MIN_HEIGHT, mediaPosition } from '../shared';
35
35
  import { unlock } from '../../lock-unlock';
36
36
  import { useToolsPanelDropdownMenuProps } from '../../utils/hooks';
37
37
  import { DEFAULT_MEDIA_SIZE_SLUG } from '../constants';
38
+ import PosterImage from './poster-image';
38
39
 
39
40
  const { cleanEmptyObject, ResolutionTool, HTMLElementControl } = unlock(
40
41
  blockEditorPrivateApis
@@ -110,6 +111,7 @@ export default function CoverInspectorControls( {
110
111
  minHeightUnit,
111
112
  alt,
112
113
  tagName,
114
+ poster,
113
115
  } = attributes;
114
116
  const {
115
117
  isVideoBackground,
@@ -198,8 +200,9 @@ export default function CoverInspectorControls( {
198
200
  focalPoint: undefined,
199
201
  isRepeated: false,
200
202
  alt: '',
201
- sizeSlug: undefined,
203
+ poster: undefined,
202
204
  } );
205
+ updateImage( DEFAULT_MEDIA_SIZE_SLUG );
203
206
  } }
204
207
  dropdownMenuProps={ dropdownMenuProps }
205
208
  >
@@ -208,7 +211,7 @@ export default function CoverInspectorControls( {
208
211
  <ToolsPanelItem
209
212
  label={ __( 'Fixed background' ) }
210
213
  isShownByDefault
211
- hasValue={ () => hasParallax }
214
+ hasValue={ () => !! hasParallax }
212
215
  onDeselect={ () =>
213
216
  setAttributes( {
214
217
  hasParallax: false,
@@ -219,7 +222,7 @@ export default function CoverInspectorControls( {
219
222
  <ToggleControl
220
223
  __nextHasNoMarginBottom
221
224
  label={ __( 'Fixed background' ) }
222
- checked={ hasParallax }
225
+ checked={ !! hasParallax }
223
226
  onChange={ toggleParallax }
224
227
  />
225
228
  </ToolsPanelItem>
@@ -269,6 +272,12 @@ export default function CoverInspectorControls( {
269
272
  />
270
273
  </ToolsPanelItem>
271
274
  ) }
275
+ { isVideoBackground && (
276
+ <PosterImage
277
+ poster={ poster }
278
+ setAttributes={ setAttributes }
279
+ />
280
+ ) }
272
281
  { ! useFeaturedImage && url && ! isVideoBackground && (
273
282
  <ToolsPanelItem
274
283
  label={ __( 'Alternative text' ) }
@@ -0,0 +1,91 @@
1
+ /**
2
+ * WordPress dependencies
3
+ */
4
+ import { MediaUpload, MediaUploadCheck } from '@wordpress/block-editor';
5
+ import {
6
+ Button,
7
+ BaseControl,
8
+ __experimentalHStack as HStack,
9
+ __experimentalToolsPanelItem as ToolsPanelItem,
10
+ } from '@wordpress/components';
11
+ import { __, sprintf } from '@wordpress/i18n';
12
+ import { useRef } from '@wordpress/element';
13
+ import { useInstanceId } from '@wordpress/compose';
14
+
15
+ const COVER_POSTER_ALLOWED_MEDIA_TYPES = [ 'image' ];
16
+
17
+ function PosterImage( { poster, setAttributes } ) {
18
+ const posterButtonRef = useRef();
19
+ const descriptionId = useInstanceId(
20
+ PosterImage,
21
+ 'cover-block__poster-image-description'
22
+ );
23
+
24
+ function onSelectPoster( image ) {
25
+ setAttributes( { poster: image.url } );
26
+ }
27
+
28
+ function onRemovePoster() {
29
+ setAttributes( { poster: undefined } );
30
+
31
+ // Move focus back to the Media Upload button.
32
+ posterButtonRef.current.focus();
33
+ }
34
+
35
+ return (
36
+ <MediaUploadCheck>
37
+ <ToolsPanelItem
38
+ label={ __( 'Poster image' ) }
39
+ isShownByDefault
40
+ hasValue={ () => !! poster }
41
+ onDeselect={ () => {
42
+ setAttributes( { poster: undefined } );
43
+ } }
44
+ >
45
+ <BaseControl.VisualLabel>
46
+ { __( 'Poster image' ) }
47
+ </BaseControl.VisualLabel>
48
+ <HStack justify="flex-start">
49
+ <MediaUpload
50
+ title={ __( 'Select poster image' ) }
51
+ onSelect={ onSelectPoster }
52
+ allowedTypes={ COVER_POSTER_ALLOWED_MEDIA_TYPES }
53
+ render={ ( { open } ) => (
54
+ <Button
55
+ __next40pxDefaultSize
56
+ variant="primary"
57
+ onClick={ open }
58
+ ref={ posterButtonRef }
59
+ aria-describedby={ descriptionId }
60
+ >
61
+ { ! poster ? __( 'Select' ) : __( 'Replace' ) }
62
+ </Button>
63
+ ) }
64
+ />
65
+ <p id={ descriptionId } hidden>
66
+ { poster
67
+ ? sprintf(
68
+ /* translators: %s: poster image URL. */
69
+ __( 'The current poster image url is %s.' ),
70
+ poster
71
+ )
72
+ : __(
73
+ 'There is no poster image currently selected.'
74
+ ) }
75
+ </p>
76
+ { !! poster && (
77
+ <Button
78
+ __next40pxDefaultSize
79
+ onClick={ onRemovePoster }
80
+ variant="tertiary"
81
+ >
82
+ { __( 'Remove' ) }
83
+ </Button>
84
+ ) }
85
+ </HStack>
86
+ </ToolsPanelItem>
87
+ </MediaUploadCheck>
88
+ );
89
+ }
90
+
91
+ export default PosterImage;
package/src/cover/save.js CHANGED
@@ -46,6 +46,7 @@ export default function save( { attributes } ) {
46
46
  minHeightUnit,
47
47
  tagName: Tag,
48
48
  sizeSlug,
49
+ poster,
49
50
  } = attributes;
50
51
  const overlayColorClass = getColorClassName(
51
52
  'background-color',
@@ -137,6 +138,7 @@ export default function save( { attributes } ) {
137
138
  loop
138
139
  playsInline
139
140
  src={ url }
141
+ poster={ poster }
140
142
  style={ { objectPosition } }
141
143
  data-object-fit="cover"
142
144
  data-object-position={ objectPosition }
@@ -50,7 +50,7 @@ export const settings = {
50
50
  return ! hasSummary
51
51
  ? __( 'Details. Empty.' )
52
52
  : sprintf(
53
- /* translators: accessibility text; summary title. */
53
+ /* translators: %s: accessibility text; summary title. */
54
54
  __( 'Details. %s' ),
55
55
  summary
56
56
  );
@@ -35,7 +35,7 @@
35
35
  padding: 0.5em 1em;
36
36
  display: inline-block;
37
37
 
38
- &:is(a) {
38
+ &:where(a) {
39
39
  &:hover,
40
40
  &:visited,
41
41
  &:focus,
@@ -4,3 +4,4 @@ export const LINK_DESTINATION_LIGHTBOX = 'lightbox';
4
4
  export const LINK_DESTINATION_ATTACHMENT = 'attachment';
5
5
  export const LINK_DESTINATION_MEDIA_WP_CORE = 'file';
6
6
  export const LINK_DESTINATION_ATTACHMENT_WP_CORE = 'post';
7
+ export const DEFAULT_MEDIA_SIZE_SLUG = 'large';