@wordpress/block-library 8.28.0 → 8.28.2
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.
- package/build/button/edit.js +1 -1
- package/build/button/edit.js.map +1 -1
- package/build/button/index.js +0 -1
- package/build/button/index.js.map +1 -1
- package/build/heading/index.js +0 -1
- package/build/heading/index.js.map +1 -1
- package/build/image/edit.js +1 -1
- package/build/image/edit.js.map +1 -1
- package/build/image/image.js +72 -6
- package/build/image/image.js.map +1 -1
- package/build/image/index.js +1 -1
- package/build/navigation/constants.js +1 -2
- package/build/navigation/constants.js.map +1 -1
- package/build/navigation/edit/index.js +0 -4
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/view.js +0 -23
- package/build/navigation/view.js.map +1 -1
- package/build/paragraph/index.js +1 -1
- package/build/paragraph/transforms.js +1 -1
- package/build/spacer/edit.js +5 -2
- package/build/spacer/edit.js.map +1 -1
- package/build-module/button/edit.js +1 -1
- package/build-module/button/edit.js.map +1 -1
- package/build-module/button/index.js +0 -1
- package/build-module/button/index.js.map +1 -1
- package/build-module/heading/index.js +0 -1
- package/build-module/heading/index.js.map +1 -1
- package/build-module/image/edit.js +1 -1
- package/build-module/image/edit.js.map +1 -1
- package/build-module/image/image.js +73 -7
- package/build-module/image/image.js.map +1 -1
- package/build-module/image/index.js +1 -1
- package/build-module/navigation/constants.js +0 -1
- package/build-module/navigation/constants.js.map +1 -1
- package/build-module/navigation/edit/index.js +1 -5
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/view.js +0 -23
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/paragraph/index.js +1 -1
- package/build-module/paragraph/transforms.js +1 -1
- package/build-module/spacer/edit.js +5 -2
- package/build-module/spacer/edit.js.map +1 -1
- package/build-style/editor-rtl.css +9 -2
- package/build-style/editor.css +9 -2
- package/build-style/image/editor-rtl.css +4 -0
- package/build-style/image/editor.css +4 -0
- package/build-style/navigation/editor-rtl.css +4 -2
- package/build-style/navigation/editor.css +4 -2
- package/build-style/navigation/style-rtl.css +18 -14
- package/build-style/navigation/style.css +18 -14
- package/build-style/spacer/editor-rtl.css +1 -0
- package/build-style/spacer/editor.css +1 -0
- package/build-style/style-rtl.css +18 -14
- package/build-style/style.css +18 -14
- package/package.json +34 -34
- package/src/button/block.json +0 -1
- package/src/button/edit.js +1 -1
- package/src/file/index.php +1 -1
- package/src/footnotes/index.php +24 -11
- package/src/heading/block.json +0 -1
- package/src/image/block.json +1 -6
- package/src/image/edit.js +1 -1
- package/src/image/editor.scss +5 -0
- package/src/image/image.js +115 -5
- package/src/image/index.php +2 -2
- package/src/navigation/constants.js +0 -2
- package/src/navigation/edit/index.js +1 -11
- package/src/navigation/editor.scss +1 -1
- package/src/navigation/index.php +100 -61
- package/src/navigation/style.scss +16 -18
- package/src/navigation/view.js +0 -26
- package/src/navigation-link/index.php +0 -1
- package/src/paragraph/block.json +1 -1
- package/src/query/index.php +1 -1
- package/src/query-pagination-numbers/index.php +9 -6
- package/src/search/index.php +14 -6
- package/src/spacer/edit.js +7 -2
- package/src/spacer/editor.scss +2 -0
package/src/navigation/index.php
CHANGED
|
@@ -218,7 +218,7 @@ class WP_Navigation_Block_Renderer {
|
|
|
218
218
|
// it encounters whitespace. This code strips it.
|
|
219
219
|
$blocks = block_core_navigation_filter_out_empty_blocks( $parsed_blocks );
|
|
220
220
|
|
|
221
|
-
if ( function_exists( '
|
|
221
|
+
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) ) {
|
|
222
222
|
// Run Block Hooks algorithm to inject hooked blocks.
|
|
223
223
|
$markup = block_core_navigation_insert_hooked_blocks( $blocks, $navigation_post );
|
|
224
224
|
$root_nav_block = parse_blocks( $markup )[0];
|
|
@@ -390,25 +390,16 @@ class WP_Navigation_Block_Renderer {
|
|
|
390
390
|
$text_decoration = $attributes['style']['typography']['textDecoration'] ?? null;
|
|
391
391
|
$text_decoration_class = sprintf( 'has-text-decoration-%s', $text_decoration );
|
|
392
392
|
|
|
393
|
-
// Sets the is-collapsed class when the navigation is set to always use the overlay.
|
|
394
|
-
// This saves us from needing to do this check in the view.js file (see the collapseNav function).
|
|
395
|
-
$is_collapsed_class = static::is_always_overlay( $attributes ) ? array( 'is-collapsed' ) : array();
|
|
396
|
-
|
|
397
393
|
$classes = array_merge(
|
|
398
394
|
$colors['css_classes'],
|
|
399
395
|
$font_sizes['css_classes'],
|
|
400
396
|
$is_responsive_menu ? array( 'is-responsive' ) : array(),
|
|
401
397
|
$layout_class ? array( $layout_class ) : array(),
|
|
402
|
-
$text_decoration ? array( $text_decoration_class ) : array()
|
|
403
|
-
$is_collapsed_class
|
|
398
|
+
$text_decoration ? array( $text_decoration_class ) : array()
|
|
404
399
|
);
|
|
405
400
|
return implode( ' ', $classes );
|
|
406
401
|
}
|
|
407
402
|
|
|
408
|
-
private static function is_always_overlay( $attributes ) {
|
|
409
|
-
return isset( $attributes['overlayMenu'] ) && 'always' === $attributes['overlayMenu'];
|
|
410
|
-
}
|
|
411
|
-
|
|
412
403
|
/**
|
|
413
404
|
* Get styles for the navigation block.
|
|
414
405
|
*
|
|
@@ -435,12 +426,16 @@ class WP_Navigation_Block_Renderer {
|
|
|
435
426
|
$colors = block_core_navigation_build_css_colors( $attributes );
|
|
436
427
|
$modal_unique_id = wp_unique_id( 'modal-' );
|
|
437
428
|
|
|
429
|
+
$is_hidden_by_default = isset( $attributes['overlayMenu'] ) && 'always' === $attributes['overlayMenu'];
|
|
430
|
+
|
|
438
431
|
$responsive_container_classes = array(
|
|
439
432
|
'wp-block-navigation__responsive-container',
|
|
433
|
+
$is_hidden_by_default ? 'hidden-by-default' : '',
|
|
440
434
|
implode( ' ', $colors['overlay_css_classes'] ),
|
|
441
435
|
);
|
|
442
436
|
$open_button_classes = array(
|
|
443
437
|
'wp-block-navigation__responsive-container-open',
|
|
438
|
+
$is_hidden_by_default ? 'always-shown' : '',
|
|
444
439
|
);
|
|
445
440
|
|
|
446
441
|
$should_display_icon_label = isset( $attributes['hasIcon'] ) && true === $attributes['hasIcon'];
|
|
@@ -538,7 +533,7 @@ class WP_Navigation_Block_Renderer {
|
|
|
538
533
|
);
|
|
539
534
|
|
|
540
535
|
if ( $is_responsive_menu ) {
|
|
541
|
-
$nav_element_directives = static::get_nav_element_directives( $is_interactive
|
|
536
|
+
$nav_element_directives = static::get_nav_element_directives( $is_interactive );
|
|
542
537
|
$wrapper_attributes .= ' ' . $nav_element_directives;
|
|
543
538
|
}
|
|
544
539
|
|
|
@@ -552,34 +547,22 @@ class WP_Navigation_Block_Renderer {
|
|
|
552
547
|
* @param array $attributes The block attributes.
|
|
553
548
|
* @return string the directives for the navigation element.
|
|
554
549
|
*/
|
|
555
|
-
private static function get_nav_element_directives( $is_interactive
|
|
550
|
+
private static function get_nav_element_directives( $is_interactive ) {
|
|
556
551
|
if ( ! $is_interactive ) {
|
|
557
552
|
return '';
|
|
558
553
|
}
|
|
559
554
|
// When adding to this array be mindful of security concerns.
|
|
560
|
-
$nav_element_context =
|
|
555
|
+
$nav_element_context = data_wp_context(
|
|
561
556
|
array(
|
|
562
557
|
'overlayOpenedBy' => array(),
|
|
563
558
|
'type' => 'overlay',
|
|
564
559
|
'roleAttribute' => '',
|
|
565
560
|
'ariaLabel' => __( 'Menu' ),
|
|
566
|
-
)
|
|
567
|
-
JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_AMP
|
|
561
|
+
)
|
|
568
562
|
);
|
|
569
563
|
$nav_element_directives = '
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
';
|
|
573
|
-
|
|
574
|
-
/*
|
|
575
|
-
* When the navigation's 'overlayMenu' attribute is set to 'always', JavaScript
|
|
576
|
-
* is not needed for collapsing the menu because the class is set manually.
|
|
577
|
-
*/
|
|
578
|
-
if ( ! static::is_always_overlay( $attributes ) ) {
|
|
579
|
-
$nav_element_directives .= 'data-wp-init="callbacks.initNav"';
|
|
580
|
-
$nav_element_directives .= ' '; // space separator
|
|
581
|
-
$nav_element_directives .= 'data-wp-class--is-collapsed="context.isCollapsed"';
|
|
582
|
-
}
|
|
564
|
+
data-wp-interactive="core/navigation"'
|
|
565
|
+
. $nav_element_context;
|
|
583
566
|
|
|
584
567
|
return $nav_element_directives;
|
|
585
568
|
}
|
|
@@ -780,7 +763,7 @@ function block_core_navigation_add_directives_to_submenu( $tags, $block_attribut
|
|
|
780
763
|
)
|
|
781
764
|
) ) {
|
|
782
765
|
// Add directives to the parent `<li>`.
|
|
783
|
-
$tags->set_attribute( 'data-wp-interactive', '
|
|
766
|
+
$tags->set_attribute( 'data-wp-interactive', 'core/navigation' );
|
|
784
767
|
$tags->set_attribute( 'data-wp-context', '{ "submenuOpenedBy": {}, "type": "submenu" }' );
|
|
785
768
|
$tags->set_attribute( 'data-wp-watch', 'callbacks.initMenu' );
|
|
786
769
|
$tags->set_attribute( 'data-wp-on--focusout', 'actions.handleMenuFocusout' );
|
|
@@ -1026,7 +1009,7 @@ function block_core_navigation_get_fallback_blocks() {
|
|
|
1026
1009
|
// In this case default to the (Page List) fallback.
|
|
1027
1010
|
$fallback_blocks = ! empty( $maybe_fallback ) ? $maybe_fallback : $fallback_blocks;
|
|
1028
1011
|
|
|
1029
|
-
if ( function_exists( '
|
|
1012
|
+
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) ) {
|
|
1030
1013
|
// Run Block Hooks algorithm to inject hooked blocks.
|
|
1031
1014
|
// We have to run it here because we need the post ID of the Navigation block to track ignored hooked blocks.
|
|
1032
1015
|
$markup = block_core_navigation_insert_hooked_blocks( $fallback_blocks, $navigation_post );
|
|
@@ -1371,25 +1354,28 @@ function block_core_navigation_get_most_recently_published_navigation() {
|
|
|
1371
1354
|
}
|
|
1372
1355
|
|
|
1373
1356
|
/**
|
|
1374
|
-
*
|
|
1357
|
+
* Accepts the serialized markup of a block and its inner blocks, and returns serialized markup of the inner blocks.
|
|
1375
1358
|
*
|
|
1376
|
-
*
|
|
1377
|
-
*
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1359
|
+
* @param string $serialized_block The serialized markup of a block and its inner blocks.
|
|
1360
|
+
* @return string
|
|
1361
|
+
*/
|
|
1362
|
+
function block_core_navigation_remove_serialized_parent_block( $serialized_block ) {
|
|
1363
|
+
$start = strpos( $serialized_block, '-->' ) + strlen( '-->' );
|
|
1364
|
+
$end = strrpos( $serialized_block, '<!--' );
|
|
1365
|
+
return substr( $serialized_block, $start, $end - $start );
|
|
1366
|
+
}
|
|
1367
|
+
|
|
1368
|
+
/**
|
|
1369
|
+
* Mock a parsed block for the Navigation block given its inner blocks and the `wp_navigation` post object.
|
|
1370
|
+
* The `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is queried to add the `metadata.ignoredHookedBlocks` attribute.
|
|
1383
1371
|
*
|
|
1384
1372
|
* @param array $inner_blocks Parsed inner blocks of a Navigation block.
|
|
1385
1373
|
* @param WP_Post $post `wp_navigation` post object corresponding to the block.
|
|
1386
|
-
*
|
|
1374
|
+
*
|
|
1375
|
+
* @return array the normalized parsed blocks.
|
|
1387
1376
|
*/
|
|
1388
|
-
function
|
|
1389
|
-
$
|
|
1390
|
-
$after_block_visitor = null;
|
|
1391
|
-
$hooked_blocks = get_hooked_blocks();
|
|
1392
|
-
$attributes = array();
|
|
1377
|
+
function block_core_navigation_mock_parsed_block( $inner_blocks, $post ) {
|
|
1378
|
+
$attributes = array();
|
|
1393
1379
|
|
|
1394
1380
|
if ( isset( $post->ID ) ) {
|
|
1395
1381
|
$ignored_hooked_blocks = get_post_meta( $post->ID, '_wp_ignored_hooked_blocks', true );
|
|
@@ -1407,15 +1393,62 @@ function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
|
|
|
1407
1393
|
'innerBlocks' => $inner_blocks,
|
|
1408
1394
|
'innerContent' => array_fill( 0, count( $inner_blocks ), null ),
|
|
1409
1395
|
);
|
|
1410
|
-
|
|
1411
|
-
$
|
|
1396
|
+
|
|
1397
|
+
return $mock_anchor_parent_block;
|
|
1398
|
+
}
|
|
1399
|
+
|
|
1400
|
+
/**
|
|
1401
|
+
* Insert hooked blocks into a Navigation block.
|
|
1402
|
+
*
|
|
1403
|
+
* Given a Navigation block's inner blocks and its corresponding `wp_navigation` post object,
|
|
1404
|
+
* this function inserts hooked blocks into it, and returns the serialized inner blocks in a
|
|
1405
|
+
* mock Navigation block wrapper.
|
|
1406
|
+
*
|
|
1407
|
+
* If there are any hooked blocks that need to be inserted as the Navigation block's first or last
|
|
1408
|
+
* children, the `wp_navigation` post's `_wp_ignored_hooked_blocks` meta is checked to see if any
|
|
1409
|
+
* of those hooked blocks should be exempted from insertion.
|
|
1410
|
+
*
|
|
1411
|
+
* @param array $inner_blocks Parsed inner blocks of a Navigation block.
|
|
1412
|
+
* @param WP_Post $post `wp_navigation` post object corresponding to the block.
|
|
1413
|
+
* @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any.
|
|
1414
|
+
*/
|
|
1415
|
+
function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
|
|
1416
|
+
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
|
|
1417
|
+
$hooked_blocks = get_hooked_blocks();
|
|
1418
|
+
$before_block_visitor = null;
|
|
1419
|
+
$after_block_visitor = null;
|
|
1420
|
+
|
|
1421
|
+
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
|
|
1422
|
+
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
|
|
1423
|
+
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'insert_hooked_blocks' );
|
|
1424
|
+
}
|
|
1425
|
+
|
|
1426
|
+
return traverse_and_serialize_block( $mock_navigation_block, $before_block_visitor, $after_block_visitor );
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
/**
|
|
1430
|
+
* Insert ignoredHookedBlocks meta into the Navigation block and its inner blocks.
|
|
1431
|
+
*
|
|
1432
|
+
* Given a Navigation block's inner blocks and its corresponding `wp_navigation` post object,
|
|
1433
|
+
* this function inserts ignoredHookedBlocks meta into it, and returns the serialized inner blocks in a
|
|
1434
|
+
* mock Navigation block wrapper.
|
|
1435
|
+
*
|
|
1436
|
+
* @param array $inner_blocks Parsed inner blocks of a Navigation block.
|
|
1437
|
+
* @param WP_Post $post `wp_navigation` post object corresponding to the block.
|
|
1438
|
+
* @return string Serialized inner blocks in mock Navigation block wrapper, with hooked blocks inserted, if any.
|
|
1439
|
+
*/
|
|
1440
|
+
function block_core_navigation_set_ignored_hooked_blocks_metadata( $inner_blocks, $post ) {
|
|
1441
|
+
$mock_navigation_block = block_core_navigation_mock_parsed_block( $inner_blocks, $post );
|
|
1442
|
+
$hooked_blocks = get_hooked_blocks();
|
|
1443
|
+
$before_block_visitor = null;
|
|
1444
|
+
$after_block_visitor = null;
|
|
1412
1445
|
|
|
1413
1446
|
if ( ! empty( $hooked_blocks ) || has_filter( 'hooked_block_types' ) ) {
|
|
1414
|
-
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post );
|
|
1415
|
-
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post );
|
|
1447
|
+
$before_block_visitor = make_before_block_visitor( $hooked_blocks, $post, 'set_ignored_hooked_blocks_metadata' );
|
|
1448
|
+
$after_block_visitor = make_after_block_visitor( $hooked_blocks, $post, 'set_ignored_hooked_blocks_metadata' );
|
|
1416
1449
|
}
|
|
1417
1450
|
|
|
1418
|
-
return traverse_and_serialize_block( $
|
|
1451
|
+
return traverse_and_serialize_block( $mock_navigation_block, $before_block_visitor, $after_block_visitor );
|
|
1419
1452
|
}
|
|
1420
1453
|
|
|
1421
1454
|
/**
|
|
@@ -1424,12 +1457,11 @@ function block_core_navigation_insert_hooked_blocks( $inner_blocks, $post ) {
|
|
|
1424
1457
|
* @param WP_Post $post Post object.
|
|
1425
1458
|
*/
|
|
1426
1459
|
function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
|
1427
|
-
// We run the Block Hooks mechanism
|
|
1428
|
-
//
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
$markup = block_core_navigation_insert_hooked_blocks( $blocks, $post );
|
|
1460
|
+
// We run the Block Hooks mechanism to inject the `metadata.ignoredHookedBlocks` attribute into
|
|
1461
|
+
// all anchor blocks. For the root level, we create a mock Navigation and extract them from there.
|
|
1462
|
+
$blocks = parse_blocks( $post->post_content );
|
|
1463
|
+
$markup = block_core_navigation_set_ignored_hooked_blocks_metadata( $blocks, $post );
|
|
1464
|
+
|
|
1433
1465
|
$root_nav_block = parse_blocks( $markup )[0];
|
|
1434
1466
|
$ignored_hooked_blocks = isset( $root_nav_block['attrs']['metadata']['ignoredHookedBlocks'] )
|
|
1435
1467
|
? $root_nav_block['attrs']['metadata']['ignoredHookedBlocks']
|
|
@@ -1443,6 +1475,15 @@ function block_core_navigation_update_ignore_hooked_blocks_meta( $post ) {
|
|
|
1443
1475
|
}
|
|
1444
1476
|
update_post_meta( $post->ID, '_wp_ignored_hooked_blocks', json_encode( $ignored_hooked_blocks ) );
|
|
1445
1477
|
}
|
|
1478
|
+
|
|
1479
|
+
$serialized_inner_blocks = block_core_navigation_remove_serialized_parent_block( $markup );
|
|
1480
|
+
|
|
1481
|
+
wp_update_post(
|
|
1482
|
+
array(
|
|
1483
|
+
'ID' => $post->ID,
|
|
1484
|
+
'post_content' => $serialized_inner_blocks,
|
|
1485
|
+
)
|
|
1486
|
+
);
|
|
1446
1487
|
}
|
|
1447
1488
|
|
|
1448
1489
|
// Before adding our filter, we verify if it's already added in Core.
|
|
@@ -1452,7 +1493,7 @@ $rest_insert_wp_navigation_core_callback = 'block_core_navigation_' . 'update_ig
|
|
|
1452
1493
|
|
|
1453
1494
|
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
|
1454
1495
|
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
|
1455
|
-
if ( function_exists( '
|
|
1496
|
+
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_insert_wp_navigation', $rest_insert_wp_navigation_core_callback ) ) {
|
|
1456
1497
|
add_action( 'rest_insert_wp_navigation', 'block_core_navigation_update_ignore_hooked_blocks_meta', 10, 3 );
|
|
1457
1498
|
}
|
|
1458
1499
|
|
|
@@ -1472,9 +1513,7 @@ function block_core_navigation_insert_hooked_blocks_into_rest_response( $respons
|
|
|
1472
1513
|
$content = block_core_navigation_insert_hooked_blocks( $parsed_blocks, $post );
|
|
1473
1514
|
|
|
1474
1515
|
// Remove mock Navigation block wrapper.
|
|
1475
|
-
$
|
|
1476
|
-
$end = strrpos( $content, '<!--' );
|
|
1477
|
-
$content = substr( $content, $start, $end - $start );
|
|
1516
|
+
$content = block_core_navigation_remove_serialized_parent_block( $content );
|
|
1478
1517
|
|
|
1479
1518
|
$response->data['content']['raw'] = $content;
|
|
1480
1519
|
$response->data['content']['rendered'] = apply_filters( 'the_content', $content );
|
|
@@ -1489,6 +1528,6 @@ $rest_prepare_wp_navigation_core_callback = 'block_core_navigation_' . 'insert_h
|
|
|
1489
1528
|
|
|
1490
1529
|
// Injection of hooked blocks into the Navigation block relies on some functions present in WP >= 6.5
|
|
1491
1530
|
// that are not present in Gutenberg's WP 6.5 compatibility layer.
|
|
1492
|
-
if ( function_exists( '
|
|
1531
|
+
if ( function_exists( 'set_ignored_hooked_blocks_metadata' ) && ! has_filter( 'rest_prepare_wp_navigation', $rest_prepare_wp_navigation_core_callback ) ) {
|
|
1493
1532
|
add_filter( 'rest_prepare_wp_navigation', 'block_core_navigation_insert_hooked_blocks_into_rest_response', 10, 3 );
|
|
1494
1533
|
}
|
|
@@ -611,19 +611,18 @@ button.wp-block-navigation-item__content {
|
|
|
611
611
|
}
|
|
612
612
|
}
|
|
613
613
|
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
display: none;
|
|
614
|
+
@include break-small() {
|
|
615
|
+
&:not(.hidden-by-default) {
|
|
616
|
+
&:not(.is-menu-open) {
|
|
617
|
+
display: block;
|
|
618
|
+
width: 100%;
|
|
619
|
+
position: relative;
|
|
620
|
+
z-index: auto;
|
|
621
|
+
background-color: inherit;
|
|
622
|
+
|
|
623
|
+
.wp-block-navigation__responsive-container-close {
|
|
624
|
+
display: none;
|
|
625
|
+
}
|
|
627
626
|
}
|
|
628
627
|
}
|
|
629
628
|
|
|
@@ -687,11 +686,10 @@ button.wp-block-navigation-item__content {
|
|
|
687
686
|
font-size: inherit;
|
|
688
687
|
}
|
|
689
688
|
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
display: none;
|
|
689
|
+
&:not(.always-shown) {
|
|
690
|
+
@include break-small {
|
|
691
|
+
display: none;
|
|
692
|
+
}
|
|
695
693
|
}
|
|
696
694
|
}
|
|
697
695
|
|
package/src/navigation/view.js
CHANGED
|
@@ -3,11 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { store, getContext, getElement } from '@wordpress/interactivity';
|
|
5
5
|
|
|
6
|
-
/**
|
|
7
|
-
* Internal dependencies
|
|
8
|
-
*/
|
|
9
|
-
import { NAVIGATION_MOBILE_COLLAPSE } from './constants';
|
|
10
|
-
|
|
11
6
|
const focusableSelectors = [
|
|
12
7
|
'a[href]',
|
|
13
8
|
'input:not([disabled]):not([type="hidden"]):not([aria-hidden])',
|
|
@@ -201,27 +196,6 @@ const { state, actions } = store(
|
|
|
201
196
|
focusableElements?.[ 0 ]?.focus();
|
|
202
197
|
}
|
|
203
198
|
},
|
|
204
|
-
initNav() {
|
|
205
|
-
const context = getContext();
|
|
206
|
-
const mediaQuery = window.matchMedia(
|
|
207
|
-
`(max-width: ${ NAVIGATION_MOBILE_COLLAPSE })`
|
|
208
|
-
);
|
|
209
|
-
|
|
210
|
-
// Run once to set the initial state.
|
|
211
|
-
context.isCollapsed = mediaQuery.matches;
|
|
212
|
-
|
|
213
|
-
function handleCollapse( event ) {
|
|
214
|
-
context.isCollapsed = event.matches;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
// Run on resize to update the state.
|
|
218
|
-
mediaQuery.addEventListener( 'change', handleCollapse );
|
|
219
|
-
|
|
220
|
-
// Remove the listener when the component is unmounted.
|
|
221
|
-
return () => {
|
|
222
|
-
mediaQuery.removeEventListener( 'change', handleCollapse );
|
|
223
|
-
};
|
|
224
|
-
},
|
|
225
199
|
},
|
|
226
200
|
},
|
|
227
201
|
{ lock: true }
|
|
@@ -392,7 +392,6 @@ function block_core_navigation_link_build_variations() {
|
|
|
392
392
|
* Registers the navigation link block.
|
|
393
393
|
*
|
|
394
394
|
* @uses render_block_core_navigation_link()
|
|
395
|
-
* @uses build_navigation_link_block_variations()
|
|
396
395
|
* @throws WP_Error An WP_Error exception parsing the block definition.
|
|
397
396
|
*/
|
|
398
397
|
function register_block_core_navigation_link() {
|
package/src/paragraph/block.json
CHANGED
package/src/query/index.php
CHANGED
|
@@ -49,7 +49,7 @@ function render_block_core_query( $attributes, $content, $block ) {
|
|
|
49
49
|
$p = new WP_HTML_Tag_Processor( $content );
|
|
50
50
|
if ( $p->next_tag() ) {
|
|
51
51
|
// Add the necessary directives.
|
|
52
|
-
$p->set_attribute( 'data-wp-interactive', '
|
|
52
|
+
$p->set_attribute( 'data-wp-interactive', 'core/query' );
|
|
53
53
|
$p->set_attribute( 'data-wp-router-region', 'query-' . $attributes['queryId'] );
|
|
54
54
|
$p->set_attribute( 'data-wp-init', 'callbacks.setQueryRef' );
|
|
55
55
|
$p->set_attribute( 'data-wp-context', '{}' );
|
|
@@ -91,14 +91,17 @@ function render_block_core_query_pagination_numbers( $attributes, $content, $blo
|
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
if ( $enhanced_pagination ) {
|
|
94
|
-
$p
|
|
94
|
+
$p = new WP_HTML_Tag_Processor( $content );
|
|
95
|
+
$tag_index = 0;
|
|
95
96
|
while ( $p->next_tag(
|
|
96
|
-
array(
|
|
97
|
-
'tag_name' => 'a',
|
|
98
|
-
'class_name' => 'page-numbers',
|
|
99
|
-
)
|
|
97
|
+
array( 'class_name' => 'page-numbers' )
|
|
100
98
|
) ) {
|
|
101
|
-
$p->
|
|
99
|
+
if ( null === $p->get_attribute( 'data-wp-key' ) ) {
|
|
100
|
+
$p->set_attribute( 'data-wp-key', 'index-' . $tag_index++ );
|
|
101
|
+
}
|
|
102
|
+
if ( 'A' === $p->get_tag() ) {
|
|
103
|
+
$p->set_attribute( 'data-wp-on--click', 'core/query::actions.navigate' );
|
|
104
|
+
}
|
|
102
105
|
}
|
|
103
106
|
$content = $p->get_updated_html();
|
|
104
107
|
}
|
package/src/search/index.php
CHANGED
|
@@ -47,7 +47,7 @@ function render_block_core_search( $attributes ) {
|
|
|
47
47
|
$border_color_classes = get_border_color_classes_for_block_core_search( $attributes );
|
|
48
48
|
// This variable is a constant and its value is always false at this moment.
|
|
49
49
|
// It is defined this way because some values depend on it, in case it changes in the future.
|
|
50
|
-
$open_by_default =
|
|
50
|
+
$open_by_default = false;
|
|
51
51
|
|
|
52
52
|
$label_inner_html = empty( $attributes['label'] ) ? __( 'Search' ) : wp_kses_post( $attributes['label'] );
|
|
53
53
|
$label = new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>', $inline_styles['label'], $label_inner_html ) );
|
|
@@ -179,12 +179,20 @@ function render_block_core_search( $attributes ) {
|
|
|
179
179
|
if ( $is_expandable_searchfield ) {
|
|
180
180
|
$aria_label_expanded = __( 'Submit Search' );
|
|
181
181
|
$aria_label_collapsed = __( 'Expand search field' );
|
|
182
|
+
$form_context = data_wp_context(
|
|
183
|
+
array(
|
|
184
|
+
'isSearchInputVisible' => $open_by_default,
|
|
185
|
+
'inputId' => $input_id,
|
|
186
|
+
'ariaLabelExpanded' => $aria_label_expanded,
|
|
187
|
+
'ariaLabelCollapsed' => $aria_label_collapsed,
|
|
188
|
+
)
|
|
189
|
+
);
|
|
182
190
|
$form_directives = '
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
191
|
+
data-wp-interactive="core/search"'
|
|
192
|
+
. $form_context .
|
|
193
|
+
'data-wp-class--wp-block-search__searchfield-hidden="!context.isSearchInputVisible"
|
|
194
|
+
data-wp-on--keydown="actions.handleSearchKeydown"
|
|
195
|
+
data-wp-on--focusout="actions.handleSearchFocusout"
|
|
188
196
|
';
|
|
189
197
|
}
|
|
190
198
|
|
package/src/spacer/edit.js
CHANGED
|
@@ -93,9 +93,14 @@ const SpacerEdit = ( {
|
|
|
93
93
|
return editorSettings?.disableCustomSpacingSizes;
|
|
94
94
|
} );
|
|
95
95
|
const { orientation } = context;
|
|
96
|
-
const {
|
|
96
|
+
const {
|
|
97
|
+
orientation: parentOrientation,
|
|
98
|
+
type,
|
|
99
|
+
default: { type: defaultType } = {},
|
|
100
|
+
} = parentLayout || {};
|
|
97
101
|
// Check if the spacer is inside a flex container.
|
|
98
|
-
const isFlexLayout =
|
|
102
|
+
const isFlexLayout =
|
|
103
|
+
type === 'flex' || ( ! type && defaultType === 'flex' );
|
|
99
104
|
// If the spacer is inside a flex container, it should either inherit the orientation
|
|
100
105
|
// of the parent or use the flex default orientation.
|
|
101
106
|
const inheritedOrientation =
|