@wordpress/block-library 8.17.1 → 8.18.1-next.5a1d1283.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 (124) hide show
  1. package/CHANGELOG.md +2 -0
  2. package/build/column/edit.native.js +5 -5
  3. package/build/column/edit.native.js.map +1 -1
  4. package/build/cover/edit/index.js +3 -1
  5. package/build/cover/edit/index.js.map +1 -1
  6. package/build/cover/shared.js +26 -21
  7. package/build/cover/shared.js.map +1 -1
  8. package/build/embed/embed-link-settings.native.js +0 -1
  9. package/build/embed/embed-link-settings.native.js.map +1 -1
  10. package/build/footnotes/edit.js +2 -3
  11. package/build/footnotes/edit.js.map +1 -1
  12. package/build/group/index.js +1 -0
  13. package/build/group/index.js.map +1 -1
  14. package/build/post-content/edit.js +1 -1
  15. package/build/post-content/edit.js.map +1 -1
  16. package/build/post-template/index.js +1 -1
  17. package/build/post-terms/use-post-terms.js +3 -2
  18. package/build/post-terms/use-post-terms.js.map +1 -1
  19. package/build/query/edit/inspector-controls/index.js +28 -3
  20. package/build/query/edit/inspector-controls/index.js.map +1 -1
  21. package/build/query/edit/query-content.js +2 -1
  22. package/build/query/edit/query-content.js.map +1 -1
  23. package/build/query/index.js +9 -2
  24. package/build/query/index.js.map +1 -1
  25. package/build/query/view.js +75 -0
  26. package/build/query/view.js.map +1 -0
  27. package/build/query-pagination-next/index.js +1 -1
  28. package/build/query-pagination-numbers/edit.js +50 -5
  29. package/build/query-pagination-numbers/edit.js.map +1 -1
  30. package/build/query-pagination-numbers/index.js +7 -1
  31. package/build/query-pagination-numbers/index.js.map +1 -1
  32. package/build/query-pagination-previous/index.js +1 -1
  33. package/build/search/edit.js +3 -1
  34. package/build/search/edit.js.map +1 -1
  35. package/build/search/utils.js +2 -4
  36. package/build/search/utils.js.map +1 -1
  37. package/build/social-link/edit.native.js +1 -3
  38. package/build/social-link/edit.native.js.map +1 -1
  39. package/build-module/column/edit.native.js +5 -5
  40. package/build-module/column/edit.native.js.map +1 -1
  41. package/build-module/cover/edit/index.js +3 -1
  42. package/build-module/cover/edit/index.js.map +1 -1
  43. package/build-module/cover/shared.js +26 -21
  44. package/build-module/cover/shared.js.map +1 -1
  45. package/build-module/embed/embed-link-settings.native.js +0 -1
  46. package/build-module/embed/embed-link-settings.native.js.map +1 -1
  47. package/build-module/footnotes/edit.js +2 -3
  48. package/build-module/footnotes/edit.js.map +1 -1
  49. package/build-module/group/index.js +1 -0
  50. package/build-module/group/index.js.map +1 -1
  51. package/build-module/post-content/edit.js +1 -1
  52. package/build-module/post-content/edit.js.map +1 -1
  53. package/build-module/post-template/index.js +1 -1
  54. package/build-module/post-terms/use-post-terms.js +3 -2
  55. package/build-module/post-terms/use-post-terms.js.map +1 -1
  56. package/build-module/query/edit/inspector-controls/index.js +29 -4
  57. package/build-module/query/edit/inspector-controls/index.js.map +1 -1
  58. package/build-module/query/edit/query-content.js +2 -1
  59. package/build-module/query/edit/query-content.js.map +1 -1
  60. package/build-module/query/index.js +9 -2
  61. package/build-module/query/index.js.map +1 -1
  62. package/build-module/query/view.js +72 -0
  63. package/build-module/query/view.js.map +1 -0
  64. package/build-module/query-pagination-next/index.js +1 -1
  65. package/build-module/query-pagination-numbers/edit.js +51 -6
  66. package/build-module/query-pagination-numbers/edit.js.map +1 -1
  67. package/build-module/query-pagination-numbers/index.js +7 -1
  68. package/build-module/query-pagination-numbers/index.js.map +1 -1
  69. package/build-module/query-pagination-previous/index.js +1 -1
  70. package/build-module/search/edit.js +4 -2
  71. package/build-module/search/edit.js.map +1 -1
  72. package/build-module/search/utils.js +0 -1
  73. package/build-module/search/utils.js.map +1 -1
  74. package/build-module/social-link/edit.native.js +1 -3
  75. package/build-module/social-link/edit.native.js.map +1 -1
  76. package/build-style/query/style-rtl.css +140 -0
  77. package/build-style/query/style.css +140 -0
  78. package/build-style/site-logo/style-rtl.css +1 -0
  79. package/build-style/site-logo/style.css +1 -0
  80. package/build-style/style-rtl.css +1 -0
  81. package/build-style/style.css +1 -0
  82. package/package.json +32 -32
  83. package/src/audio/test/__snapshots__/edit.native.js.snap +106 -78
  84. package/src/column/edit.native.js +4 -4
  85. package/src/columns/test/__snapshots__/edit.native.js.snap +14 -0
  86. package/src/columns/test/edit.native.js +47 -17
  87. package/src/cover/edit/index.js +3 -1
  88. package/src/cover/shared.js +25 -20
  89. package/src/cover/test/edit.native.js +1 -5
  90. package/src/embed/embed-link-settings.native.js +0 -1
  91. package/src/embed/test/index.native.js +9 -9
  92. package/src/file/test/__snapshots__/edit.native.js.snap +218 -162
  93. package/src/footnotes/edit.js +3 -1
  94. package/src/group/block.json +1 -0
  95. package/src/image/index.php +5 -0
  96. package/src/post-content/edit.js +2 -2
  97. package/src/post-content/index.php +0 -6
  98. package/src/post-featured-image/index.php +0 -6
  99. package/src/post-navigation-link/index.php +10 -1
  100. package/src/post-template/block.json +2 -1
  101. package/src/post-template/index.php +19 -4
  102. package/src/post-terms/use-post-terms.js +4 -2
  103. package/src/query/block.json +9 -2
  104. package/src/query/edit/inspector-controls/index.js +46 -3
  105. package/src/query/edit/query-content.js +1 -0
  106. package/src/query/index.php +94 -1
  107. package/src/query/style.scss +63 -0
  108. package/src/query/view.js +82 -0
  109. package/src/query-no-results/index.php +1 -5
  110. package/src/query-pagination-next/block.json +7 -1
  111. package/src/query-pagination-next/index.php +20 -3
  112. package/src/query-pagination-numbers/block.json +7 -1
  113. package/src/query-pagination-numbers/edit.js +64 -16
  114. package/src/query-pagination-numbers/index.php +27 -4
  115. package/src/query-pagination-previous/block.json +7 -1
  116. package/src/query-pagination-previous/index.php +19 -2
  117. package/src/search/edit.js +8 -2
  118. package/src/search/test/__snapshots__/edit.native.js.snap +363 -265
  119. package/src/search/utils.js +0 -1
  120. package/src/site-logo/style.scss +1 -0
  121. package/src/social-link/edit.native.js +1 -1
  122. package/src/social-link/editor.native.scss +0 -4
  123. package/src/social-links/test/edit.native.js +30 -0
  124. package/src/social-link/test/index.native.js +0 -132
@@ -64,7 +64,7 @@ exports[`File block renders file error state without crashing 1`] = `
64
64
  ]
65
65
  }
66
66
  >
67
- <RCTAztecView
67
+ <View
68
68
  accessibilityState={
69
69
  {
70
70
  "busy": undefined,
@@ -74,59 +74,73 @@ exports[`File block renders file error state without crashing 1`] = `
74
74
  "selected": undefined,
75
75
  }
76
76
  }
77
- accessible={true}
78
- activeFormats={[]}
79
- blockType={
77
+ accessibilityValue={
80
78
  {
81
- "tag": "p",
79
+ "max": undefined,
80
+ "min": undefined,
81
+ "now": undefined,
82
+ "text": undefined,
82
83
  }
83
84
  }
84
- deleteEnter={true}
85
- disableEditingMenu={false}
85
+ accessible={false}
86
+ collapsable={false}
86
87
  focusable={true}
87
- fontFamily="serif"
88
- fontSize={16}
89
- isMultiline={false}
90
- maxImagesWidth={200}
91
- onBackspace={[Function]}
92
88
  onBlur={[Function]}
93
- onChange={[Function]}
94
89
  onClick={[Function]}
95
- onContentSizeChange={[Function]}
96
- onEnter={[Function]}
97
90
  onFocus={[Function]}
98
- onHTMLContentWithCursor={[Function]}
99
- onKeyDown={[Function]}
100
- onPaste={[Function]}
101
91
  onResponderGrant={[Function]}
102
92
  onResponderMove={[Function]}
103
93
  onResponderRelease={[Function]}
104
94
  onResponderTerminate={[Function]}
105
95
  onResponderTerminationRequest={[Function]}
106
- onSelectionChange={[Function]}
107
96
  onStartShouldSetResponder={[Function]}
108
- placeholder="File name"
109
- placeholderTextColor="gray"
110
- selectionColor="black"
111
- style={
112
- {
113
- "backgroundColor": undefined,
114
- "maxWidth": undefined,
115
- "minHeight": 0,
97
+ >
98
+ <RCTAztecView
99
+ activeFormats={[]}
100
+ blockType={
101
+ {
102
+ "tag": "p",
103
+ }
116
104
  }
117
- }
118
- text={
119
- {
120
- "eventCount": undefined,
121
- "linkTextColor": undefined,
122
- "selection": null,
123
- "tag": "p",
124
- "text": "<p>File name</p>",
105
+ deleteEnter={true}
106
+ disableEditingMenu={false}
107
+ fontFamily="serif"
108
+ fontSize={16}
109
+ isMultiline={false}
110
+ maxImagesWidth={200}
111
+ onBackspace={[Function]}
112
+ onBlur={[Function]}
113
+ onChange={[Function]}
114
+ onContentSizeChange={[Function]}
115
+ onEnter={[Function]}
116
+ onFocus={[Function]}
117
+ onHTMLContentWithCursor={[Function]}
118
+ onKeyDown={[Function]}
119
+ onPaste={[Function]}
120
+ onSelectionChange={[Function]}
121
+ placeholder="File name"
122
+ placeholderTextColor="gray"
123
+ selectionColor="black"
124
+ style={
125
+ {
126
+ "backgroundColor": undefined,
127
+ "maxWidth": undefined,
128
+ "minHeight": 0,
129
+ }
125
130
  }
126
- }
127
- textAlign="left"
128
- triggerKeyCodes={[]}
129
- />
131
+ text={
132
+ {
133
+ "eventCount": undefined,
134
+ "linkTextColor": undefined,
135
+ "selection": null,
136
+ "tag": "p",
137
+ "text": "<p>File name</p>",
138
+ }
139
+ }
140
+ textAlign="left"
141
+ triggerKeyCodes={[]}
142
+ />
143
+ </View>
130
144
  </View>
131
145
  <View>
132
146
  <Svg
@@ -179,7 +193,7 @@ exports[`File block renders file error state without crashing 1`] = `
179
193
  ]
180
194
  }
181
195
  >
182
- <RCTAztecView
196
+ <View
183
197
  accessibilityState={
184
198
  {
185
199
  "busy": undefined,
@@ -189,62 +203,76 @@ exports[`File block renders file error state without crashing 1`] = `
189
203
  "selected": undefined,
190
204
  }
191
205
  }
192
- accessible={true}
193
- activeFormats={[]}
194
- blockType={
206
+ accessibilityValue={
195
207
  {
196
- "tag": "p",
208
+ "max": undefined,
209
+ "min": undefined,
210
+ "now": undefined,
211
+ "text": undefined,
197
212
  }
198
213
  }
199
- color="white"
200
- deleteEnter={true}
201
- disableEditingMenu={false}
214
+ accessible={false}
215
+ collapsable={false}
202
216
  focusable={true}
203
- fontFamily="serif"
204
- fontSize={16}
205
- isMultiline={false}
206
- maxImagesWidth={200}
207
- minWidth={40}
208
- onBackspace={[Function]}
209
217
  onBlur={[Function]}
210
- onChange={[Function]}
211
218
  onClick={[Function]}
212
- onContentSizeChange={[Function]}
213
- onEnter={[Function]}
214
219
  onFocus={[Function]}
215
- onHTMLContentWithCursor={[Function]}
216
- onKeyDown={[Function]}
217
- onPaste={[Function]}
218
220
  onResponderGrant={[Function]}
219
221
  onResponderMove={[Function]}
220
222
  onResponderRelease={[Function]}
221
223
  onResponderTerminate={[Function]}
222
224
  onResponderTerminationRequest={[Function]}
223
- onSelectionChange={[Function]}
224
225
  onStartShouldSetResponder={[Function]}
225
- placeholder=""
226
- placeholderTextColor="white"
227
- selectionColor="white"
228
- style={
229
- {
230
- "backgroundColor": undefined,
231
- "color": "white",
232
- "maxWidth": 80,
233
- "minHeight": 0,
226
+ >
227
+ <RCTAztecView
228
+ activeFormats={[]}
229
+ blockType={
230
+ {
231
+ "tag": "p",
232
+ }
234
233
  }
235
- }
236
- text={
237
- {
238
- "eventCount": undefined,
239
- "linkTextColor": undefined,
240
- "selection": null,
241
- "tag": "p",
242
- "text": "<p>Download</p>",
234
+ color="white"
235
+ deleteEnter={true}
236
+ disableEditingMenu={false}
237
+ fontFamily="serif"
238
+ fontSize={16}
239
+ isMultiline={false}
240
+ maxImagesWidth={200}
241
+ minWidth={40}
242
+ onBackspace={[Function]}
243
+ onBlur={[Function]}
244
+ onChange={[Function]}
245
+ onContentSizeChange={[Function]}
246
+ onEnter={[Function]}
247
+ onFocus={[Function]}
248
+ onHTMLContentWithCursor={[Function]}
249
+ onKeyDown={[Function]}
250
+ onPaste={[Function]}
251
+ onSelectionChange={[Function]}
252
+ placeholder=""
253
+ placeholderTextColor="white"
254
+ selectionColor="white"
255
+ style={
256
+ {
257
+ "backgroundColor": undefined,
258
+ "color": "white",
259
+ "maxWidth": 80,
260
+ "minHeight": 0,
261
+ }
243
262
  }
244
- }
245
- textAlign="center"
246
- triggerKeyCodes={[]}
247
- />
263
+ text={
264
+ {
265
+ "eventCount": undefined,
266
+ "linkTextColor": undefined,
267
+ "selection": null,
268
+ "tag": "p",
269
+ "text": "<p>Download</p>",
270
+ }
271
+ }
272
+ textAlign="center"
273
+ triggerKeyCodes={[]}
274
+ />
275
+ </View>
248
276
  </View>
249
277
  </View>
250
278
  </View>
@@ -315,7 +343,7 @@ exports[`File block renders file without crashing 1`] = `
315
343
  ]
316
344
  }
317
345
  >
318
- <RCTAztecView
346
+ <View
319
347
  accessibilityState={
320
348
  {
321
349
  "busy": undefined,
@@ -325,59 +353,73 @@ exports[`File block renders file without crashing 1`] = `
325
353
  "selected": undefined,
326
354
  }
327
355
  }
328
- accessible={true}
329
- activeFormats={[]}
330
- blockType={
356
+ accessibilityValue={
331
357
  {
332
- "tag": "p",
358
+ "max": undefined,
359
+ "min": undefined,
360
+ "now": undefined,
361
+ "text": undefined,
333
362
  }
334
363
  }
335
- deleteEnter={true}
336
- disableEditingMenu={false}
364
+ accessible={false}
365
+ collapsable={false}
337
366
  focusable={true}
338
- fontFamily="serif"
339
- fontSize={16}
340
- isMultiline={false}
341
- maxImagesWidth={200}
342
- onBackspace={[Function]}
343
367
  onBlur={[Function]}
344
- onChange={[Function]}
345
368
  onClick={[Function]}
346
- onContentSizeChange={[Function]}
347
- onEnter={[Function]}
348
369
  onFocus={[Function]}
349
- onHTMLContentWithCursor={[Function]}
350
- onKeyDown={[Function]}
351
- onPaste={[Function]}
352
370
  onResponderGrant={[Function]}
353
371
  onResponderMove={[Function]}
354
372
  onResponderRelease={[Function]}
355
373
  onResponderTerminate={[Function]}
356
374
  onResponderTerminationRequest={[Function]}
357
- onSelectionChange={[Function]}
358
375
  onStartShouldSetResponder={[Function]}
359
- placeholder="File name"
360
- placeholderTextColor="gray"
361
- selectionColor="black"
362
- style={
363
- {
364
- "backgroundColor": undefined,
365
- "maxWidth": undefined,
366
- "minHeight": 0,
376
+ >
377
+ <RCTAztecView
378
+ activeFormats={[]}
379
+ blockType={
380
+ {
381
+ "tag": "p",
382
+ }
367
383
  }
368
- }
369
- text={
370
- {
371
- "eventCount": undefined,
372
- "linkTextColor": undefined,
373
- "selection": null,
374
- "tag": "p",
375
- "text": "<p>File name</p>",
384
+ deleteEnter={true}
385
+ disableEditingMenu={false}
386
+ fontFamily="serif"
387
+ fontSize={16}
388
+ isMultiline={false}
389
+ maxImagesWidth={200}
390
+ onBackspace={[Function]}
391
+ onBlur={[Function]}
392
+ onChange={[Function]}
393
+ onContentSizeChange={[Function]}
394
+ onEnter={[Function]}
395
+ onFocus={[Function]}
396
+ onHTMLContentWithCursor={[Function]}
397
+ onKeyDown={[Function]}
398
+ onPaste={[Function]}
399
+ onSelectionChange={[Function]}
400
+ placeholder="File name"
401
+ placeholderTextColor="gray"
402
+ selectionColor="black"
403
+ style={
404
+ {
405
+ "backgroundColor": undefined,
406
+ "maxWidth": undefined,
407
+ "minHeight": 0,
408
+ }
376
409
  }
377
- }
378
- textAlign="left"
379
- triggerKeyCodes={[]}
380
- />
410
+ text={
411
+ {
412
+ "eventCount": undefined,
413
+ "linkTextColor": undefined,
414
+ "selection": null,
415
+ "tag": "p",
416
+ "text": "<p>File name</p>",
417
+ }
418
+ }
419
+ textAlign="left"
420
+ triggerKeyCodes={[]}
421
+ />
422
+ </View>
381
423
  </View>
382
424
  </View>
383
425
  <View
@@ -404,7 +446,7 @@ exports[`File block renders file without crashing 1`] = `
404
446
  ]
405
447
  }
406
448
  >
407
- <RCTAztecView
449
+ <View
408
450
  accessibilityState={
409
451
  {
410
452
  "busy": undefined,
@@ -414,62 +456,76 @@ exports[`File block renders file without crashing 1`] = `
414
456
  "selected": undefined,
415
457
  }
416
458
  }
417
- accessible={true}
418
- activeFormats={[]}
419
- blockType={
459
+ accessibilityValue={
420
460
  {
421
- "tag": "p",
461
+ "max": undefined,
462
+ "min": undefined,
463
+ "now": undefined,
464
+ "text": undefined,
422
465
  }
423
466
  }
424
- color="white"
425
- deleteEnter={true}
426
- disableEditingMenu={false}
467
+ accessible={false}
468
+ collapsable={false}
427
469
  focusable={true}
428
- fontFamily="serif"
429
- fontSize={16}
430
- isMultiline={false}
431
- maxImagesWidth={200}
432
- minWidth={40}
433
- onBackspace={[Function]}
434
470
  onBlur={[Function]}
435
- onChange={[Function]}
436
471
  onClick={[Function]}
437
- onContentSizeChange={[Function]}
438
- onEnter={[Function]}
439
472
  onFocus={[Function]}
440
- onHTMLContentWithCursor={[Function]}
441
- onKeyDown={[Function]}
442
- onPaste={[Function]}
443
473
  onResponderGrant={[Function]}
444
474
  onResponderMove={[Function]}
445
475
  onResponderRelease={[Function]}
446
476
  onResponderTerminate={[Function]}
447
477
  onResponderTerminationRequest={[Function]}
448
- onSelectionChange={[Function]}
449
478
  onStartShouldSetResponder={[Function]}
450
- placeholder=""
451
- placeholderTextColor="white"
452
- selectionColor="white"
453
- style={
454
- {
455
- "backgroundColor": undefined,
456
- "color": "white",
457
- "maxWidth": 80,
458
- "minHeight": 0,
479
+ >
480
+ <RCTAztecView
481
+ activeFormats={[]}
482
+ blockType={
483
+ {
484
+ "tag": "p",
485
+ }
459
486
  }
460
- }
461
- text={
462
- {
463
- "eventCount": undefined,
464
- "linkTextColor": undefined,
465
- "selection": null,
466
- "tag": "p",
467
- "text": "<p>Download</p>",
487
+ color="white"
488
+ deleteEnter={true}
489
+ disableEditingMenu={false}
490
+ fontFamily="serif"
491
+ fontSize={16}
492
+ isMultiline={false}
493
+ maxImagesWidth={200}
494
+ minWidth={40}
495
+ onBackspace={[Function]}
496
+ onBlur={[Function]}
497
+ onChange={[Function]}
498
+ onContentSizeChange={[Function]}
499
+ onEnter={[Function]}
500
+ onFocus={[Function]}
501
+ onHTMLContentWithCursor={[Function]}
502
+ onKeyDown={[Function]}
503
+ onPaste={[Function]}
504
+ onSelectionChange={[Function]}
505
+ placeholder=""
506
+ placeholderTextColor="white"
507
+ selectionColor="white"
508
+ style={
509
+ {
510
+ "backgroundColor": undefined,
511
+ "color": "white",
512
+ "maxWidth": 80,
513
+ "minHeight": 0,
514
+ }
468
515
  }
469
- }
470
- textAlign="center"
471
- triggerKeyCodes={[]}
472
- />
516
+ text={
517
+ {
518
+ "eventCount": undefined,
519
+ "linkTextColor": undefined,
520
+ "selection": null,
521
+ "tag": "p",
522
+ "text": "<p>Download</p>",
523
+ }
524
+ }
525
+ textAlign="center"
526
+ triggerKeyCodes={[]}
527
+ />
528
+ </View>
473
529
  </View>
474
530
  </View>
475
531
  </View>
@@ -23,7 +23,9 @@ export default function FootnotesEdit( { context: { postType, postId } } ) {
23
23
  <Placeholder
24
24
  icon={ <BlockIcon icon={ icon } /> }
25
25
  label={ __( 'Footnotes' ) }
26
- // To do: add instructions. We can't add new string in RC.
26
+ instructions={ __(
27
+ 'Footnotes are not supported here. Add this block to post or page content.'
28
+ ) }
27
29
  />
28
30
  </div>
29
31
  );
@@ -31,6 +31,7 @@
31
31
  "color": {
32
32
  "gradients": true,
33
33
  "heading": true,
34
+ "button": true,
34
35
  "link": true,
35
36
  "__experimentalDefaultControls": {
36
37
  "background": true,
@@ -54,6 +54,11 @@ function render_block_core_image( $attributes, $content, $block ) {
54
54
  $should_load_view_script = true;
55
55
  }
56
56
 
57
+ // If at least one block in the page has the lightbox, mark the block type as interactive.
58
+ if ( $should_load_view_script ) {
59
+ $block->block_type->supports['interactivity'] = true;
60
+ }
61
+
57
62
  $view_js_file = 'wp-block-image-view';
58
63
  if ( ! wp_script_is( $view_js_file ) ) {
59
64
  $script_handles = $block->block_type->view_script_handles;
@@ -103,7 +103,7 @@ function Placeholder( { layoutClassNames } ) {
103
103
  <div { ...blockProps }>
104
104
  <p>
105
105
  { __(
106
- 'This is the Post Content block, it will display all the blocks in any single post or page.'
106
+ 'This is the Content block, it will display all the blocks in any single post or page.'
107
107
  ) }
108
108
  </p>
109
109
  <p>
@@ -113,7 +113,7 @@ function Placeholder( { layoutClassNames } ) {
113
113
  </p>
114
114
  <p>
115
115
  { __(
116
- 'If there are any Custom Post Types registered at your site, the Post Content block can display the contents of those entries as well.'
116
+ 'If there are any Custom Post Types registered at your site, the Content block can display the contents of those entries as well.'
117
117
  ) }
118
118
  </p>
119
119
  </div>
@@ -35,12 +35,6 @@ function render_block_core_post_content( $attributes, $content, $block ) {
35
35
 
36
36
  $seen_ids[ $post_id ] = true;
37
37
 
38
- // Check is needed for backward compatibility with third-party plugins
39
- // that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
40
- if ( ! in_the_loop() && have_posts() ) {
41
- the_post();
42
- }
43
-
44
38
  // When inside the main loop, we want to use queried object
45
39
  // so that `the_preview` for the current post can apply.
46
40
  // We force this behavior by omitting the third argument (post ID) from the `get_the_content`.
@@ -19,12 +19,6 @@ function render_block_core_post_featured_image( $attributes, $content, $block )
19
19
  }
20
20
  $post_ID = $block->context['postId'];
21
21
 
22
- // Check is needed for backward compatibility with third-party plugins
23
- // that might rely on the `in_the_loop` check; calling `the_post` sets it to true.
24
- if ( ! in_the_loop() && have_posts() ) {
25
- the_post();
26
- }
27
-
28
22
  $is_link = isset( $attributes['isLink'] ) && $attributes['isLink'];
29
23
  $size_slug = isset( $attributes['sizeSlug'] ) ? $attributes['sizeSlug'] : 'post-thumbnail';
30
24
  $attr = get_block_core_post_featured_image_border_attributes( $attributes );
@@ -28,7 +28,16 @@ function render_block_core_post_navigation_link( $attributes, $content ) {
28
28
  if ( isset( $attributes['textAlign'] ) ) {
29
29
  $classes .= " has-text-align-{$attributes['textAlign']}";
30
30
  }
31
- $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $classes ) );
31
+ $styles = '';
32
+ if ( isset( $attributes['style']['typography']['writingMode'] ) ) {
33
+ $styles = "writing-mode:{$attributes['style']['typography']['writingMode']};";
34
+ }
35
+ $wrapper_attributes = get_block_wrapper_attributes(
36
+ array(
37
+ 'class' => $classes,
38
+ 'style' => $styles,
39
+ )
40
+ );
32
41
  // Set default values.
33
42
  $format = '%link';
34
43
  $link = 'next' === $navigation_type ? _x( 'Next', 'label for next post link' ) : _x( 'Previous', 'label for previous post link' );
@@ -13,7 +13,8 @@
13
13
  "queryContext",
14
14
  "displayLayout",
15
15
  "templateSlug",
16
- "previewPostType"
16
+ "previewPostType",
17
+ "enhancedPagination"
17
18
  ],
18
19
  "supports": {
19
20
  "reusable": false,
@@ -43,14 +43,26 @@ function block_core_post_template_uses_featured_image( $inner_blocks ) {
43
43
  * @return string Returns the output of the query, structured using the layout defined by the block's inner blocks.
44
44
  */
45
45
  function render_block_core_post_template( $attributes, $content, $block ) {
46
- $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
47
- $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
46
+ $page_key = isset( $block->context['queryId'] ) ? 'query-' . $block->context['queryId'] . '-page' : 'query-page';
47
+ $enhanced_pagination = isset( $block->context['enhancedPagination'] ) && $block->context['enhancedPagination'];
48
+ $page = empty( $_GET[ $page_key ] ) ? 1 : (int) $_GET[ $page_key ];
48
49
 
49
50
  // Use global query if needed.
50
51
  $use_global_query = ( isset( $block->context['query']['inherit'] ) && $block->context['query']['inherit'] );
51
52
  if ( $use_global_query ) {
52
53
  global $wp_query;
53
- $query = clone $wp_query;
54
+
55
+ /*
56
+ * If already in the main query loop, duplicate the query instance to not tamper with the main instance.
57
+ * Since this is a nested query, it should start at the beginning, therefore rewind posts.
58
+ * Otherwise, the main query loop has not started yet and this block is responsible for doing so.
59
+ */
60
+ if ( in_the_loop() ) {
61
+ $query = clone $wp_query;
62
+ $query->rewind_posts();
63
+ } else {
64
+ $query = $wp_query;
65
+ }
54
66
  } else {
55
67
  $query_args = build_query_vars_from_query_block( $block, $page );
56
68
  $query = new WP_Query( $query_args );
@@ -109,7 +121,10 @@ function render_block_core_post_template( $attributes, $content, $block ) {
109
121
 
110
122
  // Wrap the render inner blocks in a `li` element with the appropriate post classes.
111
123
  $post_classes = implode( ' ', get_post_class( 'wp-block-post' ) );
112
- $content .= '<li class="' . esc_attr( $post_classes ) . '">' . $block_content . '</li>';
124
+
125
+ $inner_block_directives = $enhanced_pagination ? ' data-wp-key="post-template-item-' . $post_id . '"' : '';
126
+
127
+ $content .= '<li' . $inner_block_directives . ' class="' . esc_attr( $post_classes ) . '">' . $block_content . '</li>';
113
128
  }
114
129
 
115
130
  /*
@@ -4,6 +4,8 @@
4
4
  import { store as coreStore } from '@wordpress/core-data';
5
5
  import { useSelect } from '@wordpress/data';
6
6
 
7
+ const EMPTY_ARRAY = [];
8
+
7
9
  export default function usePostTerms( { postId, term } ) {
8
10
  const { slug } = term;
9
11
 
@@ -12,8 +14,8 @@ export default function usePostTerms( { postId, term } ) {
12
14
  const visible = term?.visibility?.publicly_queryable;
13
15
  if ( ! visible ) {
14
16
  return {
15
- postTerms: [],
16
- _isLoading: false,
17
+ postTerms: EMPTY_ARRAY,
18
+ isLoading: false,
17
19
  hasPostTerms: false,
18
20
  };
19
21
  }