@wordpress/block-library 8.33.0 → 8.34.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 (259) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/block/edit.js +15 -8
  3. package/build/block/edit.js.map +1 -1
  4. package/build/block-keyboard-shortcuts/index.js +95 -0
  5. package/build/block-keyboard-shortcuts/index.js.map +1 -0
  6. package/build/column/edit.js +28 -19
  7. package/build/column/edit.js.map +1 -1
  8. package/build/column/edit.native.js +3 -1
  9. package/build/column/edit.native.js.map +1 -1
  10. package/build/columns/edit.js +69 -53
  11. package/build/columns/edit.js.map +1 -1
  12. package/build/columns/variations.js +18 -28
  13. package/build/columns/variations.js.map +1 -1
  14. package/build/comment-template/util.js +3 -1
  15. package/build/comment-template/util.js.map +1 -1
  16. package/build/cover/shared.js +3 -1
  17. package/build/cover/shared.js.map +1 -1
  18. package/build/embed/embed-placeholder.js +8 -3
  19. package/build/embed/embed-placeholder.js.map +1 -1
  20. package/build/embed/util.js +3 -1
  21. package/build/embed/util.js.map +1 -1
  22. package/build/embed/variations.js +3 -1
  23. package/build/embed/variations.js.map +1 -1
  24. package/build/embed/wp-embed-preview.js +6 -2
  25. package/build/embed/wp-embed-preview.js.map +1 -1
  26. package/build/group/index.js +0 -8
  27. package/build/group/index.js.map +1 -1
  28. package/build/group/placeholder.js +18 -19
  29. package/build/group/placeholder.js.map +1 -1
  30. package/build/image/image.js +3 -1
  31. package/build/image/image.js.map +1 -1
  32. package/build/image/view.js +3 -1
  33. package/build/image/view.js.map +1 -1
  34. package/build/index.js +9 -1
  35. package/build/index.js.map +1 -1
  36. package/build/list-item/hooks/use-merge.js +12 -4
  37. package/build/list-item/hooks/use-merge.js.map +1 -1
  38. package/build/list-item/hooks/use-outdent-list-item.js +15 -5
  39. package/build/list-item/hooks/use-outdent-list-item.js.map +1 -1
  40. package/build/navigation/edit/are-blocks-dirty.js +9 -3
  41. package/build/navigation/edit/are-blocks-dirty.js.map +1 -1
  42. package/build/navigation/edit/deleted-navigation-warning.js +1 -1
  43. package/build/navigation/edit/deleted-navigation-warning.js.map +1 -1
  44. package/build/navigation/edit/menu-inspector-controls.js +3 -1
  45. package/build/navigation/edit/menu-inspector-controls.js.map +1 -1
  46. package/build/navigation/edit/navigation-menu-selector.js +1 -1
  47. package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
  48. package/build/navigation/index.js +0 -9
  49. package/build/navigation/index.js.map +1 -1
  50. package/build/navigation/view.js +3 -1
  51. package/build/navigation/view.js.map +1 -1
  52. package/build/navigation-link/edit.js +94 -85
  53. package/build/navigation-link/edit.js.map +1 -1
  54. package/build/navigation-link/link-ui.js +2 -7
  55. package/build/navigation-link/link-ui.js.map +1 -1
  56. package/build/paragraph/index.js +0 -1
  57. package/build/paragraph/index.js.map +1 -1
  58. package/build/paragraph/transforms.js +0 -1
  59. package/build/paragraph/transforms.js.map +1 -1
  60. package/build/post-excerpt/edit.js +3 -1
  61. package/build/post-excerpt/edit.js.map +1 -1
  62. package/build/post-featured-image/dimension-controls.js +3 -1
  63. package/build/post-featured-image/dimension-controls.js.map +1 -1
  64. package/build/post-navigation-link/variations.js +3 -1
  65. package/build/post-navigation-link/variations.js.map +1 -1
  66. package/build/post-template/edit.js +18 -8
  67. package/build/post-template/edit.js.map +1 -1
  68. package/build/post-terms/edit.js +3 -1
  69. package/build/post-terms/edit.js.map +1 -1
  70. package/build/private-apis.js +21 -0
  71. package/build/private-apis.js.map +1 -0
  72. package/build/query/edit/enhanced-pagination-modal.js +1 -1
  73. package/build/query/edit/enhanced-pagination-modal.js.map +1 -1
  74. package/build/query/edit/inspector-controls/author-control.js +6 -2
  75. package/build/query/edit/inspector-controls/author-control.js.map +1 -1
  76. package/build/query/edit/inspector-controls/create-new-post-link.js +3 -1
  77. package/build/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
  78. package/build/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
  79. package/build/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  80. package/build/query/edit/inspector-controls/parent-control.js +18 -6
  81. package/build/query/edit/inspector-controls/parent-control.js.map +1 -1
  82. package/build/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  83. package/build/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  84. package/build/query/utils.js +3 -1
  85. package/build/query/utils.js.map +1 -1
  86. package/build/query-title/variations.js +3 -1
  87. package/build/query-title/variations.js.map +1 -1
  88. package/build/social-link/edit.js +1 -1
  89. package/build/social-link/edit.js.map +1 -1
  90. package/build/social-link/variations.js +3 -1
  91. package/build/social-link/variations.js.map +1 -1
  92. package/build/template-part/variations.js +6 -2
  93. package/build/template-part/variations.js.map +1 -1
  94. package/build-module/block/edit.js +15 -8
  95. package/build-module/block/edit.js.map +1 -1
  96. package/build-module/block-keyboard-shortcuts/index.js +88 -0
  97. package/build-module/block-keyboard-shortcuts/index.js.map +1 -0
  98. package/build-module/column/edit.js +28 -19
  99. package/build-module/column/edit.js.map +1 -1
  100. package/build-module/column/edit.native.js +3 -1
  101. package/build-module/column/edit.native.js.map +1 -1
  102. package/build-module/columns/edit.js +69 -53
  103. package/build-module/columns/edit.js.map +1 -1
  104. package/build-module/columns/variations.js +18 -28
  105. package/build-module/columns/variations.js.map +1 -1
  106. package/build-module/comment-template/util.js +3 -1
  107. package/build-module/comment-template/util.js.map +1 -1
  108. package/build-module/cover/shared.js +3 -1
  109. package/build-module/cover/shared.js.map +1 -1
  110. package/build-module/embed/embed-placeholder.js +9 -4
  111. package/build-module/embed/embed-placeholder.js.map +1 -1
  112. package/build-module/embed/util.js +3 -1
  113. package/build-module/embed/util.js.map +1 -1
  114. package/build-module/embed/variations.js +3 -1
  115. package/build-module/embed/variations.js.map +1 -1
  116. package/build-module/embed/wp-embed-preview.js +6 -2
  117. package/build-module/embed/wp-embed-preview.js.map +1 -1
  118. package/build-module/group/index.js +0 -8
  119. package/build-module/group/index.js.map +1 -1
  120. package/build-module/group/placeholder.js +18 -19
  121. package/build-module/group/placeholder.js.map +1 -1
  122. package/build-module/image/image.js +3 -1
  123. package/build-module/image/image.js.map +1 -1
  124. package/build-module/image/view.js +3 -1
  125. package/build-module/image/view.js.map +1 -1
  126. package/build-module/index.js +1 -0
  127. package/build-module/index.js.map +1 -1
  128. package/build-module/list-item/hooks/use-merge.js +12 -4
  129. package/build-module/list-item/hooks/use-merge.js.map +1 -1
  130. package/build-module/list-item/hooks/use-outdent-list-item.js +15 -5
  131. package/build-module/list-item/hooks/use-outdent-list-item.js.map +1 -1
  132. package/build-module/navigation/edit/are-blocks-dirty.js +9 -3
  133. package/build-module/navigation/edit/are-blocks-dirty.js.map +1 -1
  134. package/build-module/navigation/edit/deleted-navigation-warning.js +1 -1
  135. package/build-module/navigation/edit/deleted-navigation-warning.js.map +1 -1
  136. package/build-module/navigation/edit/menu-inspector-controls.js +3 -1
  137. package/build-module/navigation/edit/menu-inspector-controls.js.map +1 -1
  138. package/build-module/navigation/edit/navigation-menu-selector.js +1 -1
  139. package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
  140. package/build-module/navigation/index.js +0 -9
  141. package/build-module/navigation/index.js.map +1 -1
  142. package/build-module/navigation/view.js +3 -1
  143. package/build-module/navigation/view.js.map +1 -1
  144. package/build-module/navigation-link/edit.js +94 -85
  145. package/build-module/navigation-link/edit.js.map +1 -1
  146. package/build-module/navigation-link/link-ui.js +3 -8
  147. package/build-module/navigation-link/link-ui.js.map +1 -1
  148. package/build-module/paragraph/index.js +0 -1
  149. package/build-module/paragraph/index.js.map +1 -1
  150. package/build-module/paragraph/transforms.js +0 -1
  151. package/build-module/paragraph/transforms.js.map +1 -1
  152. package/build-module/post-excerpt/edit.js +3 -1
  153. package/build-module/post-excerpt/edit.js.map +1 -1
  154. package/build-module/post-featured-image/dimension-controls.js +3 -1
  155. package/build-module/post-featured-image/dimension-controls.js.map +1 -1
  156. package/build-module/post-navigation-link/variations.js +3 -1
  157. package/build-module/post-navigation-link/variations.js.map +1 -1
  158. package/build-module/post-template/edit.js +18 -8
  159. package/build-module/post-template/edit.js.map +1 -1
  160. package/build-module/post-terms/edit.js +3 -1
  161. package/build-module/post-terms/edit.js.map +1 -1
  162. package/build-module/private-apis.js +14 -0
  163. package/build-module/private-apis.js.map +1 -0
  164. package/build-module/query/edit/enhanced-pagination-modal.js +1 -1
  165. package/build-module/query/edit/enhanced-pagination-modal.js.map +1 -1
  166. package/build-module/query/edit/inspector-controls/author-control.js +6 -2
  167. package/build-module/query/edit/inspector-controls/author-control.js.map +1 -1
  168. package/build-module/query/edit/inspector-controls/create-new-post-link.js +3 -1
  169. package/build-module/query/edit/inspector-controls/create-new-post-link.js.map +1 -1
  170. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js +6 -3
  171. package/build-module/query/edit/inspector-controls/enhanced-pagination-control.js.map +1 -1
  172. package/build-module/query/edit/inspector-controls/parent-control.js +18 -6
  173. package/build-module/query/edit/inspector-controls/parent-control.js.map +1 -1
  174. package/build-module/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  175. package/build-module/query/edit/inspector-controls/taxonomy-controls.js.map +1 -1
  176. package/build-module/query/utils.js +3 -1
  177. package/build-module/query/utils.js.map +1 -1
  178. package/build-module/query-title/variations.js +3 -1
  179. package/build-module/query-title/variations.js.map +1 -1
  180. package/build-module/social-link/edit.js +1 -1
  181. package/build-module/social-link/edit.js.map +1 -1
  182. package/build-module/social-link/variations.js +3 -1
  183. package/build-module/social-link/variations.js.map +1 -1
  184. package/build-module/template-part/variations.js +6 -2
  185. package/build-module/template-part/variations.js.map +1 -1
  186. package/build-style/editor-rtl.css +15 -49
  187. package/build-style/editor.css +15 -49
  188. package/build-style/embed/editor-rtl.css +0 -3
  189. package/build-style/embed/editor.css +0 -3
  190. package/build-style/group/editor-rtl.css +0 -44
  191. package/build-style/group/editor.css +0 -44
  192. package/build-style/group/style-rtl.css +4 -0
  193. package/build-style/group/style.css +4 -0
  194. package/build-style/navigation-link/style-rtl.css +0 -8
  195. package/build-style/navigation-link/style.css +0 -8
  196. package/build-style/post-featured-image/editor-rtl.css +1 -0
  197. package/build-style/post-featured-image/editor.css +1 -0
  198. package/build-style/site-logo/editor-rtl.css +1 -0
  199. package/build-style/site-logo/editor.css +1 -0
  200. package/build-style/social-link/editor-rtl.css +13 -2
  201. package/build-style/social-link/editor.css +13 -2
  202. package/build-style/style-rtl.css +4 -8
  203. package/build-style/style.css +4 -8
  204. package/package.json +35 -34
  205. package/src/block/edit.js +19 -12
  206. package/src/block-keyboard-shortcuts/index.js +113 -0
  207. package/src/column/edit.js +26 -20
  208. package/src/column/edit.native.js +3 -1
  209. package/src/columns/edit.js +93 -83
  210. package/src/columns/variations.js +12 -34
  211. package/src/comment-template/util.js +3 -1
  212. package/src/cover/shared.js +3 -1
  213. package/src/embed/editor.scss +0 -2
  214. package/src/embed/embed-placeholder.js +21 -9
  215. package/src/embed/util.js +3 -1
  216. package/src/embed/variations.js +3 -1
  217. package/src/embed/wp-embed-preview.js +6 -2
  218. package/src/gallery/test/helpers.native.js +3 -3
  219. package/src/group/editor.scss +0 -47
  220. package/src/group/index.js +0 -8
  221. package/src/group/placeholder.js +18 -18
  222. package/src/group/style.scss +5 -0
  223. package/src/image/image.js +3 -1
  224. package/src/image/view.js +3 -1
  225. package/src/index.js +2 -0
  226. package/src/list-item/hooks/use-merge.js +12 -4
  227. package/src/list-item/hooks/use-outdent-list-item.js +15 -5
  228. package/src/navigation/block.json +0 -9
  229. package/src/navigation/edit/are-blocks-dirty.js +8 -3
  230. package/src/navigation/edit/deleted-navigation-warning.js +1 -1
  231. package/src/navigation/edit/menu-inspector-controls.js +3 -1
  232. package/src/navigation/edit/navigation-menu-selector.js +1 -1
  233. package/src/navigation/edit/test/navigation-menu-selector.js +5 -5
  234. package/src/navigation/view.js +3 -1
  235. package/src/navigation-link/edit.js +91 -91
  236. package/src/navigation-link/link-ui.js +74 -89
  237. package/src/navigation-link/style.scss +0 -12
  238. package/src/paragraph/block.json +0 -1
  239. package/src/post-excerpt/edit.js +3 -1
  240. package/src/post-featured-image/dimension-controls.js +3 -1
  241. package/src/post-featured-image/editor.scss +1 -0
  242. package/src/post-navigation-link/variations.js +3 -1
  243. package/src/post-template/edit.js +9 -4
  244. package/src/post-terms/edit.js +3 -1
  245. package/src/private-apis.js +13 -0
  246. package/src/query/edit/enhanced-pagination-modal.js +5 -1
  247. package/src/query/edit/inspector-controls/author-control.js +6 -2
  248. package/src/query/edit/inspector-controls/create-new-post-link.js +3 -1
  249. package/src/query/edit/inspector-controls/enhanced-pagination-control.js +13 -3
  250. package/src/query/edit/inspector-controls/parent-control.js +18 -6
  251. package/src/query/edit/inspector-controls/taxonomy-controls.js +9 -3
  252. package/src/query/index.php +1 -1
  253. package/src/query/utils.js +3 -1
  254. package/src/query-title/variations.js +3 -1
  255. package/src/site-logo/editor.scss +1 -0
  256. package/src/social-link/edit.js +2 -2
  257. package/src/social-link/editor.scss +25 -11
  258. package/src/social-link/variations.js +3 -1
  259. package/src/template-part/variations.js +6 -2
@@ -148,7 +148,6 @@ function LinkUIBlockInserter( { clientId, onBack, onSelectBlock } ) {
148
148
  export function LinkUI( props ) {
149
149
  const [ addingBlock, setAddingBlock ] = useState( false );
150
150
  const [ focusAddBlockButton, setFocusAddBlockButton ] = useState( false );
151
- const [ showBackdrop, setShowBackdrop ] = useState( true );
152
151
  const { saveEntityRecord } = useDispatch( coreStore );
153
152
  const pagesPermissions = useResourcePermissions( 'pages' );
154
153
  const postsPermissions = useResourcePermissions( 'posts' );
@@ -214,102 +213,88 @@ export function LinkUI( props ) {
214
213
  const { onClose: onSelectBlock } = props;
215
214
 
216
215
  return (
217
- <>
218
- { showBackdrop && (
216
+ <Popover
217
+ placement="bottom"
218
+ onClose={ props.onClose }
219
+ anchor={ props.anchor }
220
+ shift
221
+ >
222
+ { ! addingBlock && (
219
223
  <div
220
- className="components-popover-pointer-events-trap"
221
- aria-hidden="true"
222
- onClick={ () => setShowBackdrop( false ) }
223
- />
224
- ) }
225
- <Popover
226
- placement="bottom"
227
- onClose={ props.onClose }
228
- anchor={ props.anchor }
229
- shift
230
- >
231
- { ! addingBlock && (
232
- <div
233
- role="dialog"
234
- aria-labelledby={ dialogTitleId }
235
- aria-describedby={ dialogDescritionId }
236
- >
237
- <VisuallyHidden>
238
- <h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>
224
+ role="dialog"
225
+ aria-labelledby={ dialogTitleId }
226
+ aria-describedby={ dialogDescritionId }
227
+ >
228
+ <VisuallyHidden>
229
+ <h2 id={ dialogTitleId }>{ __( 'Add link' ) }</h2>
239
230
 
240
- <p id={ dialogDescritionId }>
241
- { __(
242
- 'Search for and add a link to your Navigation.'
243
- ) }
244
- </p>
245
- </VisuallyHidden>
246
- <LinkControl
247
- hasTextControl
248
- hasRichPreviews
249
- value={ link }
250
- showInitialSuggestions
251
- withCreateSuggestion={ userCanCreate }
252
- createSuggestion={ handleCreate }
253
- createSuggestionButtonText={ ( searchTerm ) => {
254
- let format;
255
-
256
- if ( type === 'post' ) {
257
- /* translators: %s: search term. */
258
- format = __(
259
- 'Create draft post: <mark>%s</mark>'
260
- );
261
- } else {
262
- /* translators: %s: search term. */
263
- format = __(
264
- 'Create draft page: <mark>%s</mark>'
265
- );
266
- }
231
+ <p id={ dialogDescritionId }>
232
+ { __(
233
+ 'Search for and add a link to your Navigation.'
234
+ ) }
235
+ </p>
236
+ </VisuallyHidden>
237
+ <LinkControl
238
+ hasTextControl
239
+ hasRichPreviews
240
+ value={ link }
241
+ showInitialSuggestions
242
+ withCreateSuggestion={ userCanCreate }
243
+ createSuggestion={ handleCreate }
244
+ createSuggestionButtonText={ ( searchTerm ) => {
245
+ let format;
267
246
 
268
- return createInterpolateElement(
269
- sprintf( format, searchTerm ),
270
- {
271
- mark: <mark />,
272
- }
247
+ if ( type === 'post' ) {
248
+ /* translators: %s: search term. */
249
+ format = __(
250
+ 'Create draft post: <mark>%s</mark>'
251
+ );
252
+ } else {
253
+ /* translators: %s: search term. */
254
+ format = __(
255
+ 'Create draft page: <mark>%s</mark>'
273
256
  );
274
- } }
275
- noDirectEntry={ !! type }
276
- noURLSuggestion={ !! type }
277
- suggestionsQuery={ getSuggestionsQuery(
278
- type,
279
- kind
280
- ) }
281
- onChange={ props.onChange }
282
- onRemove={ props.onRemove }
283
- onCancel={ props.onCancel }
284
- renderControlBottom={ () =>
285
- ! link?.url?.length && (
286
- <LinkUITools
287
- focusAddBlockButton={
288
- focusAddBlockButton
289
- }
290
- setAddingBlock={ () => {
291
- setAddingBlock( true );
292
- setFocusAddBlockButton( false );
293
- } }
294
- />
295
- )
296
257
  }
297
- />
298
- </div>
299
- ) }
300
258
 
301
- { addingBlock && (
302
- <LinkUIBlockInserter
303
- clientId={ props.clientId }
304
- onBack={ () => {
305
- setAddingBlock( false );
306
- setFocusAddBlockButton( true );
259
+ return createInterpolateElement(
260
+ sprintf( format, searchTerm ),
261
+ {
262
+ mark: <mark />,
263
+ }
264
+ );
307
265
  } }
308
- onSelectBlock={ onSelectBlock }
266
+ noDirectEntry={ !! type }
267
+ noURLSuggestion={ !! type }
268
+ suggestionsQuery={ getSuggestionsQuery( type, kind ) }
269
+ onChange={ props.onChange }
270
+ onRemove={ props.onRemove }
271
+ onCancel={ props.onCancel }
272
+ renderControlBottom={ () =>
273
+ ! link?.url?.length && (
274
+ <LinkUITools
275
+ focusAddBlockButton={ focusAddBlockButton }
276
+ setAddingBlock={ () => {
277
+ setAddingBlock( true );
278
+ setFocusAddBlockButton( false );
279
+ } }
280
+ />
281
+ )
282
+ }
309
283
  />
310
- ) }
311
- </Popover>
312
- </>
284
+ </div>
285
+ ) }
286
+
287
+ { addingBlock && (
288
+ <LinkUIBlockInserter
289
+ clientId={ props.clientId }
290
+ onBack={ () => {
291
+ setAddingBlock( false );
292
+ setFocusAddBlockButton( true );
293
+ } }
294
+ onSelectBlock={ onSelectBlock }
295
+ />
296
+ ) }
297
+ </Popover>
313
298
  );
314
299
  }
315
300
 
@@ -28,15 +28,3 @@
28
28
  margin-left: $grid-unit-10;
29
29
  text-transform: uppercase;
30
30
  }
31
-
32
- // Ensure Popover `onClose` is fired for clicks on the canvas iframe.
33
- // See https: //github.com/WordPress/gutenberg/pull/57756#discussion_r1475852009.
34
- .components-popover-pointer-events-trap {
35
- // Same z-index as popover, but rendered before the popover element
36
- // in DOM order = it will display just under the popover
37
- z-index: z-index(".components-popover");
38
- position: fixed;
39
- inset: 0;
40
- background-color: transparent;
41
- cursor: pointer;
42
- }
@@ -7,7 +7,6 @@
7
7
  "description": "Start with the basic building block of all narrative.",
8
8
  "keywords": [ "text" ],
9
9
  "textdomain": "default",
10
- "usesContext": [ "postId" ],
11
10
  "attributes": {
12
11
  "align": {
13
12
  "type": "string"
@@ -89,7 +89,9 @@ export default function PostExcerptEditor( {
89
89
  * excerpt has been produced from the content.
90
90
  */
91
91
  const strippedRenderedExcerpt = useMemo( () => {
92
- if ( ! renderedExcerpt ) return '';
92
+ if ( ! renderedExcerpt ) {
93
+ return '';
94
+ }
93
95
  const document = new window.DOMParser().parseFromString(
94
96
  renderedExcerpt,
95
97
  'text/html'
@@ -81,7 +81,9 @@ const DimensionControls = ( {
81
81
  * we don't want to set the attribute, as it would
82
82
  * end up having the unit as value without any number.
83
83
  */
84
- if ( isNaN( parsedValue ) && nextValue ) return;
84
+ if ( isNaN( parsedValue ) && nextValue ) {
85
+ return;
86
+ }
85
87
  setAttributes( {
86
88
  [ dimension ]: parsedValue < 0 ? '0' : nextValue,
87
89
  } );
@@ -21,6 +21,7 @@
21
21
 
22
22
  // Style the upload button.
23
23
  .components-button {
24
+ margin: auto;
24
25
  padding: 0;
25
26
  display: flex;
26
27
  justify-content: center;
@@ -34,7 +34,9 @@ const variations = [
34
34
  * Block by providing its attributes.
35
35
  */
36
36
  variations.forEach( ( variation ) => {
37
- if ( variation.isActive ) return;
37
+ if ( variation.isActive ) {
38
+ return;
39
+ }
38
40
  variation.isActive = ( blockAttributes, variationAttributes ) =>
39
41
  blockAttributes.type === variationAttributes.type;
40
42
  } );
@@ -27,9 +27,9 @@ const TEMPLATE = [
27
27
  [ 'core/post-excerpt' ],
28
28
  ];
29
29
 
30
- function PostTemplateInnerBlocks() {
30
+ function PostTemplateInnerBlocks( { classList } ) {
31
31
  const innerBlocksProps = useInnerBlocksProps(
32
- { className: 'wp-block-post' },
32
+ { className: classnames( 'wp-block-post', classList ) },
33
33
  { template: TEMPLATE, __unstableDisableLayoutClassNames: true }
34
34
  );
35
35
  return <li { ...innerBlocksProps } />;
@@ -38,13 +38,14 @@ function PostTemplateInnerBlocks() {
38
38
  function PostTemplateBlockPreview( {
39
39
  blocks,
40
40
  blockContextId,
41
+ classList,
41
42
  isHidden,
42
43
  setActiveBlockContextId,
43
44
  } ) {
44
45
  const blockPreviewProps = useBlockPreview( {
45
46
  blocks,
46
47
  props: {
47
- className: 'wp-block-post',
48
+ className: classnames( 'wp-block-post', classList ),
48
49
  },
49
50
  } );
50
51
 
@@ -213,6 +214,7 @@ export default function PostTemplateEdit( {
213
214
  posts?.map( ( post ) => ( {
214
215
  postType: post.type,
215
216
  postId: post.id,
217
+ classList: post.class_list ?? '',
216
218
  } ) ),
217
219
  [ posts ]
218
220
  );
@@ -280,11 +282,14 @@ export default function PostTemplateEdit( {
280
282
  { blockContext.postId ===
281
283
  ( activeBlockContextId ||
282
284
  blockContexts[ 0 ]?.postId ) ? (
283
- <PostTemplateInnerBlocks />
285
+ <PostTemplateInnerBlocks
286
+ classList={ blockContext.classList }
287
+ />
284
288
  ) : null }
285
289
  <MemoizedPostTemplateBlockPreview
286
290
  blocks={ blocks }
287
291
  blockContextId={ blockContext.postId }
292
+ classList={ blockContext.classList }
288
293
  setActiveBlockContextId={
289
294
  setActiveBlockContextId
290
295
  }
@@ -49,7 +49,9 @@ export default function PostTermsEdit( {
49
49
 
50
50
  const selectedTerm = useSelect(
51
51
  ( select ) => {
52
- if ( ! term ) return {};
52
+ if ( ! term ) {
53
+ return {};
54
+ }
53
55
  const { getTaxonomy } = select( coreStore );
54
56
  const taxonomy = getTaxonomy( term );
55
57
  return taxonomy?.visibility?.publicly_queryable ? taxonomy : {};
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Internal dependencies
3
+ */
4
+ import { default as BlockKeyboardShortcuts } from './block-keyboard-shortcuts';
5
+ import { lock } from './lock-unlock';
6
+
7
+ /**
8
+ * @private
9
+ */
10
+ export const privateApis = {};
11
+ lock( privateApis, {
12
+ BlockKeyboardShortcuts,
13
+ } );
@@ -27,7 +27,11 @@ export default function EnhancedPaginationModal( {
27
27
  useUnsupportedBlocks( clientId );
28
28
 
29
29
  useEffect( () => {
30
- if ( enhancedPagination && hasUnsupportedBlocks ) {
30
+ if (
31
+ enhancedPagination &&
32
+ hasUnsupportedBlocks &&
33
+ ! window.__experimentalFullPageClientSideNavigation
34
+ ) {
31
35
  setAttributes( { enhancedPagination: false } );
32
36
  setOpen( true );
33
37
  }
@@ -52,14 +52,18 @@ function AuthorControl( { value, onChange } ) {
52
52
 
53
53
  const getIdByValue = ( entitiesMappedByName, authorValue ) => {
54
54
  const id = authorValue?.id || entitiesMappedByName[ authorValue ]?.id;
55
- if ( id ) return id;
55
+ if ( id ) {
56
+ return id;
57
+ }
56
58
  };
57
59
  const onAuthorChange = ( newValue ) => {
58
60
  const ids = Array.from(
59
61
  newValue.reduce( ( accumulator, author ) => {
60
62
  // Verify that new values point to existing entities.
61
63
  const id = getIdByValue( authorsInfo.mapByName, author );
62
- if ( id ) accumulator.add( id );
64
+ if ( id ) {
65
+ accumulator.add( id );
66
+ }
63
67
  return accumulator;
64
68
  }, new Set() )
65
69
  );
@@ -8,7 +8,9 @@ import { addQueryArgs } from '@wordpress/url';
8
8
  const CreateNewPostLink = ( {
9
9
  attributes: { query: { postType } = {} } = {},
10
10
  } ) => {
11
- if ( ! postType ) return null;
11
+ if ( ! postType ) {
12
+ return null;
13
+ }
12
14
  const newPostUrl = addQueryArgs( 'post-new.php', {
13
15
  post_type: postType,
14
16
  } );
@@ -15,9 +15,15 @@ export default function EnhancedPaginationControl( {
15
15
  clientId,
16
16
  } ) {
17
17
  const { hasUnsupportedBlocks } = useUnsupportedBlocks( clientId );
18
+ const fullPageClientSideNavigation =
19
+ window.__experimentalFullPageClientSideNavigation;
18
20
 
19
21
  let help = __( 'Browsing between pages requires a full page reload.' );
20
- if ( enhancedPagination ) {
22
+ if ( fullPageClientSideNavigation ) {
23
+ help = __(
24
+ 'Experimental full-page client-side navigation setting enabled.'
25
+ );
26
+ } else if ( enhancedPagination ) {
21
27
  help = __(
22
28
  "Browsing between pages won't require a full page reload, unless non-compatible blocks are detected."
23
29
  );
@@ -32,8 +38,12 @@ export default function EnhancedPaginationControl( {
32
38
  <ToggleControl
33
39
  label={ __( 'Force page reload' ) }
34
40
  help={ help }
35
- checked={ ! enhancedPagination }
36
- disabled={ hasUnsupportedBlocks }
41
+ checked={
42
+ ! enhancedPagination && ! fullPageClientSideNavigation
43
+ }
44
+ disabled={
45
+ hasUnsupportedBlocks || fullPageClientSideNavigation
46
+ }
37
47
  onChange={ ( value ) => {
38
48
  setAttributes( {
39
49
  enhancedPagination: ! value,
@@ -55,7 +55,9 @@ function ParentControl( { parents, postType, onChange } ) {
55
55
  );
56
56
  const currentParents = useSelect(
57
57
  ( select ) => {
58
- if ( ! parents?.length ) return EMPTY_ARRAY;
58
+ if ( ! parents?.length ) {
59
+ return EMPTY_ARRAY;
60
+ }
59
61
  const { getEntityRecords } = select( coreStore );
60
62
  return getEntityRecords( 'postType', postType, {
61
63
  ...BASE_QUERY,
@@ -71,7 +73,9 @@ function ParentControl( { parents, postType, onChange } ) {
71
73
  if ( ! parents?.length ) {
72
74
  setValue( EMPTY_ARRAY );
73
75
  }
74
- if ( ! currentParents?.length ) return;
76
+ if ( ! currentParents?.length ) {
77
+ return;
78
+ }
75
79
  const currentParentsInfo = getEntitiesInfo(
76
80
  mapToIHasNameAndId( currentParents, 'title.rendered' )
77
81
  );
@@ -91,27 +95,35 @@ function ParentControl( { parents, postType, onChange } ) {
91
95
  }, [ parents, currentParents ] );
92
96
 
93
97
  const entitiesInfo = useMemo( () => {
94
- if ( ! searchResults?.length ) return EMPTY_ARRAY;
98
+ if ( ! searchResults?.length ) {
99
+ return EMPTY_ARRAY;
100
+ }
95
101
  return getEntitiesInfo(
96
102
  mapToIHasNameAndId( searchResults, 'title.rendered' )
97
103
  );
98
104
  }, [ searchResults ] );
99
105
  // Update suggestions only when the query has resolved.
100
106
  useEffect( () => {
101
- if ( ! searchHasResolved ) return;
107
+ if ( ! searchHasResolved ) {
108
+ return;
109
+ }
102
110
  setSuggestions( entitiesInfo.names );
103
111
  }, [ entitiesInfo.names, searchHasResolved ] );
104
112
 
105
113
  const getIdByValue = ( entitiesMappedByName, entity ) => {
106
114
  const id = entity?.id || entitiesMappedByName?.[ entity ]?.id;
107
- if ( id ) return id;
115
+ if ( id ) {
116
+ return id;
117
+ }
108
118
  };
109
119
  const onParentChange = ( newValue ) => {
110
120
  const ids = Array.from(
111
121
  newValue.reduce( ( accumulator, entity ) => {
112
122
  // Verify that new values point to existing entities.
113
123
  const id = getIdByValue( entitiesInfo.mapByName, entity );
114
- if ( id ) accumulator.add( id );
124
+ if ( id ) {
125
+ accumulator.add( id );
126
+ }
115
127
  return accumulator;
116
128
  }, new Set() )
117
129
  );
@@ -124,7 +124,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
124
124
  // and to sanitize the provided `termIds`, by setting only the ones that exist.
125
125
  const existingTerms = useSelect(
126
126
  ( select ) => {
127
- if ( ! termIds?.length ) return EMPTY_ARRAY;
127
+ if ( ! termIds?.length ) {
128
+ return EMPTY_ARRAY;
129
+ }
128
130
  const { getEntityRecords } = select( coreStore );
129
131
  return getEntityRecords( 'taxonomy', taxonomy.slug, {
130
132
  ...BASE_QUERY,
@@ -140,7 +142,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
140
142
  if ( ! termIds?.length ) {
141
143
  setValue( EMPTY_ARRAY );
142
144
  }
143
- if ( ! existingTerms?.length ) return;
145
+ if ( ! existingTerms?.length ) {
146
+ return;
147
+ }
144
148
  // Returns only the existing entity ids. This prevents the component
145
149
  // from crashing in the editor, when non existing ids are provided.
146
150
  const sanitizedValue = termIds.reduce( ( accumulator, id ) => {
@@ -157,7 +161,9 @@ function TaxonomyItem( { taxonomy, termIds, onChange } ) {
157
161
  }, [ termIds, existingTerms ] );
158
162
  // Update suggestions only when the query has resolved.
159
163
  useEffect( () => {
160
- if ( ! searchHasResolved ) return;
164
+ if ( ! searchHasResolved ) {
165
+ return;
166
+ }
161
167
  setSuggestions( searchResults.map( ( result ) => result.name ) );
162
168
  }, [ searchResults, searchHasResolved ] );
163
169
  const onTermsChange = ( newTermValues ) => {
@@ -51,8 +51,8 @@ function render_block_core_query( $attributes, $content, $block ) {
51
51
  // Add the necessary directives.
52
52
  $p->set_attribute( 'data-wp-interactive', 'core/query' );
53
53
  $p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] );
54
- $p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' );
55
54
  $p->set_attribute( 'data-wp-context', '{}' );
55
+ $p->set_attribute( 'data-wp-key', $attributes['queryId'] );
56
56
  $content = $p->get_updated_html();
57
57
  }
58
58
  }
@@ -108,7 +108,9 @@ export const usePostTypes = () => {
108
108
  return filteredPostTypes;
109
109
  }, [] );
110
110
  const postTypesTaxonomiesMap = useMemo( () => {
111
- if ( ! postTypes?.length ) return;
111
+ if ( ! postTypes?.length ) {
112
+ return;
113
+ }
112
114
  return postTypes.reduce( ( accumulator, type ) => {
113
115
  accumulator[ type.slug ] = type.taxonomies;
114
116
  return accumulator;
@@ -38,7 +38,9 @@ const variations = [
38
38
  * Block by providing its attributes.
39
39
  */
40
40
  variations.forEach( ( variation ) => {
41
- if ( variation.isActive ) return;
41
+ if ( variation.isActive ) {
42
+ return;
43
+ }
42
44
  variation.isActive = ( blockAttributes, variationAttributes ) =>
43
45
  blockAttributes.type === variationAttributes.type;
44
46
  } );
@@ -88,6 +88,7 @@
88
88
  // Style the upload button.
89
89
  .components-button.components-button {
90
90
  padding: 0;
91
+ margin: auto;
91
92
  display: flex;
92
93
  justify-content: center;
93
94
  align-items: center;
@@ -158,7 +158,7 @@ const SocialLinkEdit = ( {
158
158
  />
159
159
  </InspectorControls>
160
160
  <li { ...blockProps }>
161
- <Button
161
+ <button
162
162
  className="wp-block-social-link-anchor"
163
163
  ref={ setPopoverAnchor }
164
164
  onClick={ () => setPopover( true ) }
@@ -171,7 +171,7 @@ const SocialLinkEdit = ( {
171
171
  >
172
172
  { socialLinkText }
173
173
  </span>
174
- </Button>
174
+ </button>
175
175
  { isSelected && showURLPopover && (
176
176
  <SocialLinkURLPopover
177
177
  url={ url }
@@ -1,19 +1,33 @@
1
- // The editor uses the button component, the frontend uses a link.
2
- // Therefore we unstyle the button component to make it more like the frontend.
3
1
  .wp-block-social-links .wp-social-link {
4
2
  line-height: 0;
3
+ }
4
+
5
+ // The editor uses the button element, the frontend uses a link.
6
+ // Therefore we unstyle the button element to make it more like the frontend.
7
+ .wp-block-social-link-anchor {
8
+ align-items: center;
9
+ background: none;
10
+ border: 0;
11
+ box-sizing: border-box;
12
+ cursor: pointer;
13
+ display: inline-flex;
14
+ font-size: inherit;
15
+ color: currentColor;
16
+ height: auto;
17
+
18
+ // This rule ensures social link buttons display correctly in template parts.
19
+ opacity: 1;
5
20
 
6
- button {
7
- font-size: inherit;
8
- color: currentColor;
9
- height: auto;
10
- line-height: 0;
21
+ // This rule is duplicated from the style.scss and needs to be the same as there.
22
+ padding: 0.25em;
11
23
 
12
- // This rule ensures social link buttons display correctly in template parts.
13
- opacity: 1;
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);
14
28
 
15
- // This rule is duplicated from the style.scss and needs to be the same as there.
16
- padding: 0.25em;
29
+ // Windows High Contrast mode will show this outline, but not the box-shadow.
30
+ outline: 3px solid transparent;
17
31
  }
18
32
  }
19
33
 
@@ -339,7 +339,9 @@ const variations = [
339
339
  * Block by providing its attributes.
340
340
  */
341
341
  variations.forEach( ( variation ) => {
342
- if ( variation.isActive ) return;
342
+ if ( variation.isActive ) {
343
+ return;
344
+ }
343
345
  variation.isActive = ( blockAttributes, variationAttributes ) =>
344
346
  blockAttributes.service === variationAttributes.service;
345
347
  } );
@@ -31,10 +31,14 @@ export function enhanceTemplatePartVariations( settings, name ) {
31
31
  const { area, theme, slug } = blockAttributes;
32
32
  // We first check the `area` block attribute which is set during insertion.
33
33
  // This property is removed on the creation of a template part.
34
- if ( area ) return area === variationAttributes.area;
34
+ if ( area ) {
35
+ return area === variationAttributes.area;
36
+ }
35
37
  // Find a matching variation from the created template part
36
38
  // by checking the entity's `area` property.
37
- if ( ! slug ) return false;
39
+ if ( ! slug ) {
40
+ return false;
41
+ }
38
42
  const { getCurrentTheme, getEntityRecord } =
39
43
  select( coreDataStore );
40
44
  const entity = getEntityRecord(