@wordpress/block-library 6.0.11 → 6.0.15
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/cover/edit.js +1 -0
- package/build/cover/edit.js.map +1 -1
- package/build/gallery/deprecated.js +314 -26
- package/build/gallery/deprecated.js.map +1 -1
- package/build/gallery/edit-wrapper.js +10 -27
- package/build/gallery/edit-wrapper.js.map +1 -1
- package/build/gallery/edit.js +10 -12
- package/build/gallery/edit.js.map +1 -1
- package/build/gallery/save.js +3 -3
- package/build/gallery/save.js.map +1 -1
- package/build/gallery/shared.js +24 -0
- package/build/gallery/shared.js.map +1 -1
- package/build/gallery/transforms.js +8 -22
- package/build/gallery/transforms.js.map +1 -1
- package/build/gallery/use-mobile-warning.js +1 -1
- package/build/gallery/use-mobile-warning.js.map +1 -1
- package/build/gallery/v1/edit.js +2 -21
- package/build/gallery/v1/edit.js.map +1 -1
- package/build/image/image.js +30 -6
- package/build/image/image.js.map +1 -1
- package/build/navigation/edit/index.js +12 -1
- package/build/navigation/edit/index.js.map +1 -1
- package/build/navigation/edit/inner-blocks.js +0 -4
- package/build/navigation/edit/inner-blocks.js.map +1 -1
- package/build/navigation/edit/navigation-menu-selector.js +7 -1
- package/build/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build/navigation/menu-items-to-blocks.js +4 -1
- package/build/navigation/menu-items-to-blocks.js.map +1 -1
- package/build/navigation/view.js +2 -2
- package/build/navigation/view.js.map +1 -1
- package/build/navigation-submenu/edit.js +5 -1
- package/build/navigation-submenu/edit.js.map +1 -1
- package/build/post-comments/index.js +1 -1
- package/build/query-pagination/index.js +1 -1
- package/build/query-pagination-next/index.js +1 -1
- package/build/query-pagination-numbers/index.js +1 -1
- package/build/query-pagination-previous/index.js +1 -1
- package/build/separator/separator-settings.js +1 -0
- package/build/separator/separator-settings.js.map +1 -1
- package/build/social-links/edit.js +1 -0
- package/build/social-links/edit.js.map +1 -1
- package/build-module/cover/edit.js +1 -0
- package/build-module/cover/edit.js.map +1 -1
- package/build-module/gallery/deprecated.js +309 -27
- package/build-module/gallery/deprecated.js.map +1 -1
- package/build-module/gallery/edit-wrapper.js +7 -27
- package/build-module/gallery/edit-wrapper.js.map +1 -1
- package/build-module/gallery/edit.js +10 -12
- package/build-module/gallery/edit.js.map +1 -1
- package/build-module/gallery/save.js +2 -3
- package/build-module/gallery/save.js.map +1 -1
- package/build-module/gallery/shared.js +22 -0
- package/build-module/gallery/shared.js.map +1 -1
- package/build-module/gallery/transforms.js +9 -21
- package/build-module/gallery/transforms.js.map +1 -1
- package/build-module/gallery/use-mobile-warning.js +1 -1
- package/build-module/gallery/use-mobile-warning.js.map +1 -1
- package/build-module/gallery/v1/edit.js +4 -22
- package/build-module/gallery/v1/edit.js.map +1 -1
- package/build-module/image/image.js +31 -7
- package/build-module/image/image.js.map +1 -1
- package/build-module/navigation/edit/index.js +11 -1
- package/build-module/navigation/edit/index.js.map +1 -1
- package/build-module/navigation/edit/inner-blocks.js +0 -4
- package/build-module/navigation/edit/inner-blocks.js.map +1 -1
- package/build-module/navigation/edit/navigation-menu-selector.js +6 -1
- package/build-module/navigation/edit/navigation-menu-selector.js.map +1 -1
- package/build-module/navigation/menu-items-to-blocks.js +3 -1
- package/build-module/navigation/menu-items-to-blocks.js.map +1 -1
- package/build-module/navigation/view.js +2 -2
- package/build-module/navigation/view.js.map +1 -1
- package/build-module/navigation-submenu/edit.js +5 -1
- package/build-module/navigation-submenu/edit.js.map +1 -1
- package/build-module/post-comments/index.js +1 -1
- package/build-module/query-pagination/index.js +1 -1
- package/build-module/query-pagination-next/index.js +1 -1
- package/build-module/query-pagination-numbers/index.js +1 -1
- package/build-module/query-pagination-previous/index.js +1 -1
- package/build-module/separator/separator-settings.js +1 -0
- package/build-module/separator/separator-settings.js.map +1 -1
- package/build-module/social-links/edit.js +1 -0
- package/build-module/social-links/edit.js.map +1 -1
- package/build-style/columns/editor-rtl.css +1 -1
- package/build-style/columns/editor.css +1 -1
- package/build-style/editor-rtl.css +26 -1
- package/build-style/editor.css +26 -1
- package/build-style/image/editor-rtl.css +16 -0
- package/build-style/image/editor.css +16 -0
- package/build-style/navigation/editor-rtl.css +9 -0
- package/build-style/navigation/editor.css +9 -0
- package/build-style/navigation/style-rtl.css +5 -1
- package/build-style/navigation/style.css +5 -1
- package/build-style/post-comments/style-rtl.css +3 -1
- package/build-style/post-comments/style.css +3 -1
- package/build-style/post-comments-form/style-rtl.css +2 -2
- package/build-style/post-comments-form/style.css +2 -2
- package/build-style/style-rtl.css +10 -4
- package/build-style/style.css +10 -4
- package/package.json +8 -8
- package/src/columns/editor.scss +3 -2
- package/src/cover/edit.js +1 -0
- package/src/gallery/deprecated.js +831 -559
- package/src/gallery/edit-wrapper.js +7 -27
- package/src/gallery/edit.js +10 -12
- package/src/gallery/index.php +7 -8
- package/src/gallery/save.js +2 -1
- package/src/gallery/shared.js +24 -0
- package/src/gallery/transforms.js +9 -27
- package/src/gallery/use-mobile-warning.js +1 -1
- package/src/gallery/v1/edit.js +1 -28
- package/src/image/editor.scss +18 -0
- package/src/image/image.js +32 -8
- package/src/image/index.php +1 -1
- package/src/navigation/edit/index.js +15 -6
- package/src/navigation/edit/inner-blocks.js +0 -5
- package/src/navigation/edit/navigation-menu-selector.js +8 -0
- package/src/navigation/editor.scss +12 -0
- package/src/navigation/index.php +149 -18
- package/src/navigation/menu-items-to-blocks.js +7 -1
- package/src/navigation/style.scss +5 -1
- package/src/navigation/view.js +2 -2
- package/src/navigation-submenu/edit.js +7 -1
- package/src/navigation-submenu/index.php +36 -45
- package/src/page-list/index.php +10 -9
- package/src/post-comments/block.json +5 -1
- package/src/post-comments/index.php +17 -0
- package/src/post-comments/style.scss +7 -3
- package/src/post-comments-form/index.php +6 -4
- package/src/post-comments-form/style.scss +7 -5
- package/src/query-pagination/block.json +1 -1
- package/src/query-pagination-next/block.json +1 -1
- package/src/query-pagination-numbers/block.json +1 -1
- package/src/query-pagination-previous/block.json +1 -1
- package/src/separator/separator-settings.js +1 -0
- package/src/social-links/edit.js +1 -0
- package/src/template-part/index.php +41 -2
- package/build/gallery/v1/update-gallery-modal.js +0 -114
- package/build/gallery/v1/update-gallery-modal.js.map +0 -1
- package/build-module/gallery/v1/update-gallery-modal.js +0 -97
- package/build-module/gallery/v1/update-gallery-modal.js.map +0 -1
- package/src/gallery/v1/update-gallery-modal.js +0 -97
package/src/navigation/index.php
CHANGED
|
@@ -5,6 +5,120 @@
|
|
|
5
5
|
* @package WordPress
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
+
// These functions are used for the __unstableLocation feature and only active
|
|
9
|
+
// when the gutenberg plugin is active.
|
|
10
|
+
if ( defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN ) {
|
|
11
|
+
/**
|
|
12
|
+
* Returns the menu items for a WordPress menu location.
|
|
13
|
+
*
|
|
14
|
+
* @param string $location The menu location.
|
|
15
|
+
* @return array Menu items for the location.
|
|
16
|
+
*/
|
|
17
|
+
function block_core_navigation_get_menu_items_at_location( $location ) {
|
|
18
|
+
if ( empty( $location ) ) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Build menu data. The following approximates the code in
|
|
23
|
+
// `wp_nav_menu()` and `gutenberg_output_block_nav_menu`.
|
|
24
|
+
|
|
25
|
+
// Find the location in the list of locations, returning early if the
|
|
26
|
+
// location can't be found.
|
|
27
|
+
$locations = get_nav_menu_locations();
|
|
28
|
+
if ( ! isset( $locations[ $location ] ) ) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Get the menu from the location, returning early if there is no
|
|
33
|
+
// menu or there was an error.
|
|
34
|
+
$menu = wp_get_nav_menu_object( $locations[ $location ] );
|
|
35
|
+
if ( ! $menu || is_wp_error( $menu ) ) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
$menu_items = wp_get_nav_menu_items( $menu->term_id, array( 'update_post_term_cache' => false ) );
|
|
40
|
+
_wp_menu_item_classes_by_context( $menu_items );
|
|
41
|
+
|
|
42
|
+
return $menu_items;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Sorts a standard array of menu items into a nested structure keyed by the
|
|
48
|
+
* id of the parent menu.
|
|
49
|
+
*
|
|
50
|
+
* @param array $menu_items Menu items to sort.
|
|
51
|
+
* @return array An array keyed by the id of the parent menu where each element
|
|
52
|
+
* is an array of menu items that belong to that parent.
|
|
53
|
+
*/
|
|
54
|
+
function block_core_navigation_sort_menu_items_by_parent_id( $menu_items ) {
|
|
55
|
+
$sorted_menu_items = array();
|
|
56
|
+
foreach ( (array) $menu_items as $menu_item ) {
|
|
57
|
+
$sorted_menu_items[ $menu_item->menu_order ] = $menu_item;
|
|
58
|
+
}
|
|
59
|
+
unset( $menu_items, $menu_item );
|
|
60
|
+
|
|
61
|
+
$menu_items_by_parent_id = array();
|
|
62
|
+
foreach ( $sorted_menu_items as $menu_item ) {
|
|
63
|
+
$menu_items_by_parent_id[ $menu_item->menu_item_parent ][] = $menu_item;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return $menu_items_by_parent_id;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Turns menu item data into a nested array of parsed blocks
|
|
71
|
+
*
|
|
72
|
+
* @param array $menu_items An array of menu items that represent
|
|
73
|
+
* an individual level of a menu.
|
|
74
|
+
* @param array $menu_items_by_parent_id An array keyed by the id of the
|
|
75
|
+
* parent menu where each element is an
|
|
76
|
+
* array of menu items that belong to
|
|
77
|
+
* that parent.
|
|
78
|
+
* @return array An array of parsed block data.
|
|
79
|
+
*/
|
|
80
|
+
function block_core_navigation_parse_blocks_from_menu_items( $menu_items, $menu_items_by_parent_id ) {
|
|
81
|
+
if ( empty( $menu_items ) ) {
|
|
82
|
+
return array();
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
$blocks = array();
|
|
86
|
+
|
|
87
|
+
foreach ( $menu_items as $menu_item ) {
|
|
88
|
+
$class_name = ! empty( $menu_item->classes ) ? implode( ' ', (array) $menu_item->classes ) : null;
|
|
89
|
+
$id = ( null !== $menu_item->object_id && 'custom' !== $menu_item->object ) ? $menu_item->object_id : null;
|
|
90
|
+
$opens_in_new_tab = null !== $menu_item->target && '_blank' === $menu_item->target;
|
|
91
|
+
$rel = ( null !== $menu_item->xfn && '' !== $menu_item->xfn ) ? $menu_item->xfn : null;
|
|
92
|
+
$kind = null !== $menu_item->type ? str_replace( '_', '-', $menu_item->type ) : 'custom';
|
|
93
|
+
|
|
94
|
+
$block = array(
|
|
95
|
+
'blockName' => isset( $menu_items_by_parent_id[ $menu_item->ID ] ) ? 'core/navigation-submenu' : 'core/navigation-link',
|
|
96
|
+
'attrs' => array(
|
|
97
|
+
'className' => $class_name,
|
|
98
|
+
'description' => $menu_item->description,
|
|
99
|
+
'id' => $id,
|
|
100
|
+
'kind' => $kind,
|
|
101
|
+
'label' => $menu_item->title,
|
|
102
|
+
'opensInNewTab' => $opens_in_new_tab,
|
|
103
|
+
'rel' => $rel,
|
|
104
|
+
'title' => $menu_item->attr_title,
|
|
105
|
+
'type' => $menu_item->object,
|
|
106
|
+
'url' => $menu_item->url,
|
|
107
|
+
),
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
$block['innerBlocks'] = isset( $menu_items_by_parent_id[ $menu_item->ID ] )
|
|
111
|
+
? block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[ $menu_item->ID ], $menu_items_by_parent_id )
|
|
112
|
+
: array();
|
|
113
|
+
$block['innerContent'] = array_map( 'serialize_block', $block['innerBlocks'] );
|
|
114
|
+
|
|
115
|
+
$blocks[] = $block;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
return $blocks;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
8
122
|
/**
|
|
9
123
|
* Build an array with CSS classes and inline styles defining the colors
|
|
10
124
|
* which will be applied to the navigation markup in the front-end.
|
|
@@ -145,17 +259,23 @@ function block_core_navigation_get_first_non_empty_navigation() {
|
|
|
145
259
|
// see:
|
|
146
260
|
// - https://github.com/WordPress/wordpress-develop/blob/ba943e113d3b31b121f77a2d30aebe14b047c69d/src/wp-includes/nav-menu.php#L613-L619.
|
|
147
261
|
// - https://developer.wordpress.org/reference/classes/wp_query/#order-orderby-parameters.
|
|
148
|
-
$
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
)
|
|
262
|
+
$parsed_args = array(
|
|
263
|
+
'post_type' => 'wp_navigation',
|
|
264
|
+
'no_found_rows' => true,
|
|
265
|
+
'order' => 'ASC',
|
|
266
|
+
'orderby' => 'name',
|
|
267
|
+
'post_status' => 'publish',
|
|
268
|
+
'posts_per_page' => 20, // Try the first 20 posts.
|
|
156
269
|
);
|
|
157
|
-
return count( $navigation_posts ) ? $navigation_posts[0] : null;
|
|
158
270
|
|
|
271
|
+
$navigation_posts = new WP_Query( $parsed_args );
|
|
272
|
+
foreach ( $navigation_posts->posts as $navigation_post ) {
|
|
273
|
+
if ( has_blocks( $navigation_post ) ) {
|
|
274
|
+
return $navigation_post;
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
return null;
|
|
159
279
|
}
|
|
160
280
|
|
|
161
281
|
/**
|
|
@@ -272,22 +392,33 @@ function render_block_core_navigation( $attributes, $content, $block ) {
|
|
|
272
392
|
|
|
273
393
|
$inner_blocks = $block->inner_blocks;
|
|
274
394
|
|
|
275
|
-
//
|
|
276
|
-
if (
|
|
277
|
-
$
|
|
395
|
+
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
|
396
|
+
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
|
|
397
|
+
$attributes['ref'] = $attributes['navigationMenuId'];
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
// If:
|
|
401
|
+
// - the gutenberg plugin is active
|
|
402
|
+
// - `__unstableLocation` is defined
|
|
403
|
+
// - we have menu items at the defined location
|
|
404
|
+
// - we don't have a relationship to a `wp_navigation` Post (via `ref`).
|
|
405
|
+
// ...then create inner blocks from the classic menu assigned to that location.
|
|
406
|
+
if (
|
|
407
|
+
defined( 'IS_GUTENBERG_PLUGIN' ) && IS_GUTENBERG_PLUGIN &&
|
|
408
|
+
array_key_exists( '__unstableLocation', $attributes ) &&
|
|
409
|
+
! array_key_exists( 'ref', $attributes ) &&
|
|
410
|
+
! empty( block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] ) )
|
|
411
|
+
) {
|
|
412
|
+
$menu_items = block_core_navigation_get_menu_items_at_location( $attributes['__unstableLocation'] );
|
|
278
413
|
if ( empty( $menu_items ) ) {
|
|
279
414
|
return '';
|
|
280
415
|
}
|
|
281
416
|
|
|
282
|
-
$menu_items_by_parent_id =
|
|
283
|
-
$parsed_blocks =
|
|
417
|
+
$menu_items_by_parent_id = block_core_navigation_sort_menu_items_by_parent_id( $menu_items );
|
|
418
|
+
$parsed_blocks = block_core_navigation_parse_blocks_from_menu_items( $menu_items_by_parent_id[0], $menu_items_by_parent_id );
|
|
284
419
|
$inner_blocks = new WP_Block_List( $parsed_blocks, $attributes );
|
|
285
420
|
}
|
|
286
421
|
|
|
287
|
-
// Ensure that blocks saved with the legacy ref attribute name (navigationMenuId) continue to render.
|
|
288
|
-
if ( array_key_exists( 'navigationMenuId', $attributes ) ) {
|
|
289
|
-
$attributes['ref'] = $attributes['navigationMenuId'];
|
|
290
|
-
}
|
|
291
422
|
// Load inner blocks from the navigation post.
|
|
292
423
|
if ( array_key_exists( 'ref', $attributes ) ) {
|
|
293
424
|
$navigation_post = get_post( $attributes['ref'] );
|
|
@@ -7,6 +7,7 @@ import { sortBy } from 'lodash';
|
|
|
7
7
|
* WordPress dependencies
|
|
8
8
|
*/
|
|
9
9
|
import { createBlock, parse } from '@wordpress/blocks';
|
|
10
|
+
import { applyFilters } from '@wordpress/hooks';
|
|
10
11
|
|
|
11
12
|
/**
|
|
12
13
|
* Convert a flat menu item structure to a nested blocks structure.
|
|
@@ -21,7 +22,12 @@ export default function menuItemsToBlocks( menuItems ) {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const menuTree = createDataTree( menuItems );
|
|
24
|
-
|
|
25
|
+
const blocks = mapMenuItemsToBlocks( menuTree );
|
|
26
|
+
return applyFilters(
|
|
27
|
+
'blocks.navigation.__unstableMenuItemsToBlocks',
|
|
28
|
+
blocks,
|
|
29
|
+
menuItems
|
|
30
|
+
);
|
|
25
31
|
}
|
|
26
32
|
|
|
27
33
|
/**
|
|
@@ -426,7 +426,11 @@ button.wp-block-navigation-item__content {
|
|
|
426
426
|
align-items: var(--layout-justification-setting, inherit);
|
|
427
427
|
|
|
428
428
|
// Always align the contents of the menu to the top.
|
|
429
|
-
|
|
429
|
+
&,
|
|
430
|
+
.wp-block-page-list,
|
|
431
|
+
.wp-block-navigation__container {
|
|
432
|
+
justify-content: flex-start;
|
|
433
|
+
}
|
|
430
434
|
|
|
431
435
|
// Allow menu to scroll.
|
|
432
436
|
overflow: auto;
|
package/src/navigation/view.js
CHANGED
|
@@ -58,7 +58,7 @@ function toggleSubmenuOnClick( event ) {
|
|
|
58
58
|
|
|
59
59
|
// Necessary for some themes such as TT1 Blocks, where
|
|
60
60
|
// scripts could be loaded before the body.
|
|
61
|
-
window.
|
|
61
|
+
window.addEventListener( 'load', () => {
|
|
62
62
|
MicroModal.init( {
|
|
63
63
|
onShow: navigationToggleModal,
|
|
64
64
|
onClose: navigationToggleModal,
|
|
@@ -95,4 +95,4 @@ window.onload = () => {
|
|
|
95
95
|
}
|
|
96
96
|
} );
|
|
97
97
|
} );
|
|
98
|
-
};
|
|
98
|
+
} );
|
|
@@ -508,13 +508,19 @@ export default function NavigationSubmenuEdit( {
|
|
|
508
508
|
allowedBlocks: ALLOWED_BLOCKS,
|
|
509
509
|
__experimentalDefaultBlock: DEFAULT_BLOCK,
|
|
510
510
|
__experimentalDirectInsert: true,
|
|
511
|
+
|
|
512
|
+
// Ensure block toolbar is not too far removed from item
|
|
513
|
+
// being edited.
|
|
514
|
+
// see: https://github.com/WordPress/gutenberg/pull/34615.
|
|
515
|
+
__experimentalCaptureToolbars: true,
|
|
516
|
+
|
|
511
517
|
renderAppender:
|
|
512
518
|
isSelected ||
|
|
513
519
|
( isImmediateParentOfSelectedBlock &&
|
|
514
520
|
! selectedBlockHasDescendants ) ||
|
|
515
521
|
// Show the appender while dragging to allow inserting element between item and the appender.
|
|
516
522
|
hasDescendants
|
|
517
|
-
? InnerBlocks.
|
|
523
|
+
? InnerBlocks.ButtonBlockAppender
|
|
518
524
|
: false,
|
|
519
525
|
}
|
|
520
526
|
);
|
|
@@ -163,7 +163,38 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
163
163
|
'style' => $style_attribute,
|
|
164
164
|
)
|
|
165
165
|
);
|
|
166
|
-
|
|
166
|
+
|
|
167
|
+
$label = '';
|
|
168
|
+
|
|
169
|
+
if ( isset( $attributes['label'] ) ) {
|
|
170
|
+
$label .= wp_kses(
|
|
171
|
+
$attributes['label'],
|
|
172
|
+
array(
|
|
173
|
+
'code' => array(),
|
|
174
|
+
'em' => array(),
|
|
175
|
+
'img' => array(
|
|
176
|
+
'scale' => array(),
|
|
177
|
+
'class' => array(),
|
|
178
|
+
'style' => array(),
|
|
179
|
+
'src' => array(),
|
|
180
|
+
'alt' => array(),
|
|
181
|
+
),
|
|
182
|
+
's' => array(),
|
|
183
|
+
'span' => array(
|
|
184
|
+
'style' => array(),
|
|
185
|
+
),
|
|
186
|
+
'strong' => array(),
|
|
187
|
+
)
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
$aria_label = sprintf(
|
|
192
|
+
/* translators: Accessibility text. %s: Parent page title. */
|
|
193
|
+
__( '%s submenu' ),
|
|
194
|
+
$label
|
|
195
|
+
);
|
|
196
|
+
|
|
197
|
+
$html = '<li ' . $wrapper_attributes . '>';
|
|
167
198
|
|
|
168
199
|
// If Submenus open on hover, we render an anchor tag with attributes.
|
|
169
200
|
// If submenu icons are set to show, we also render a submenu button, so the submenu can be opened on click.
|
|
@@ -193,27 +224,7 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
193
224
|
$html .= '>';
|
|
194
225
|
// End appending HTML attributes to anchor tag.
|
|
195
226
|
|
|
196
|
-
|
|
197
|
-
$html .= wp_kses(
|
|
198
|
-
$attributes['label'],
|
|
199
|
-
array(
|
|
200
|
-
'code' => array(),
|
|
201
|
-
'em' => array(),
|
|
202
|
-
'img' => array(
|
|
203
|
-
'scale' => array(),
|
|
204
|
-
'class' => array(),
|
|
205
|
-
'style' => array(),
|
|
206
|
-
'src' => array(),
|
|
207
|
-
'alt' => array(),
|
|
208
|
-
),
|
|
209
|
-
's' => array(),
|
|
210
|
-
'span' => array(
|
|
211
|
-
'style' => array(),
|
|
212
|
-
),
|
|
213
|
-
'strong' => array(),
|
|
214
|
-
)
|
|
215
|
-
);
|
|
216
|
-
}
|
|
227
|
+
$html .= $label;
|
|
217
228
|
|
|
218
229
|
$html .= '</a>';
|
|
219
230
|
// End anchor tag content.
|
|
@@ -221,36 +232,16 @@ function render_block_core_navigation_submenu( $attributes, $content, $block ) {
|
|
|
221
232
|
if ( $show_submenu_indicators ) {
|
|
222
233
|
// The submenu icon is rendered in a button here
|
|
223
234
|
// so that there's a clickable elment to open the submenu.
|
|
224
|
-
$html .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
|
|
235
|
+
$html .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">' . block_core_navigation_submenu_render_submenu_icon() . '</button>';
|
|
225
236
|
}
|
|
226
237
|
} else {
|
|
227
238
|
// If menus open on click, we render the parent as a button.
|
|
228
|
-
$html .= '<button class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
239
|
+
$html .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation-item__content wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
229
240
|
|
|
230
241
|
// Wrap title with span to isolate it from submenu icon.
|
|
231
242
|
$html .= '<span class="wp-block-navigation-item__label">';
|
|
232
243
|
|
|
233
|
-
|
|
234
|
-
$html .= wp_kses(
|
|
235
|
-
$attributes['label'],
|
|
236
|
-
array(
|
|
237
|
-
'code' => array(),
|
|
238
|
-
'em' => array(),
|
|
239
|
-
'img' => array(
|
|
240
|
-
'scale' => array(),
|
|
241
|
-
'class' => array(),
|
|
242
|
-
'style' => array(),
|
|
243
|
-
'src' => array(),
|
|
244
|
-
'alt' => array(),
|
|
245
|
-
),
|
|
246
|
-
's' => array(),
|
|
247
|
-
'span' => array(
|
|
248
|
-
'style' => array(),
|
|
249
|
-
),
|
|
250
|
-
'strong' => array(),
|
|
251
|
-
)
|
|
252
|
-
);
|
|
253
|
-
}
|
|
244
|
+
$html .= $label;
|
|
254
245
|
|
|
255
246
|
$html .= '</span>';
|
|
256
247
|
|
package/src/page-list/index.php
CHANGED
|
@@ -173,24 +173,25 @@ function block_core_page_list_render_nested_page_list( $open_submenus_on_click,
|
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
|
|
176
|
+
$title = wp_kses( $page['title'], wp_kses_allowed_html( 'post' ) );
|
|
177
|
+
$aria_label = sprintf(
|
|
178
|
+
/* translators: Accessibility text. %s: Parent page title. */
|
|
179
|
+
__( '%s submenu' ),
|
|
180
|
+
$title
|
|
181
|
+
);
|
|
182
|
+
|
|
176
183
|
$markup .= '<li class="wp-block-pages-list__item' . $css_class . '"' . $style_attribute . '>';
|
|
177
184
|
|
|
178
185
|
if ( isset( $page['children'] ) && $is_navigation_child && $open_submenus_on_click ) {
|
|
179
|
-
$markup .= '<button class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' .
|
|
180
|
-
$page['title'],
|
|
181
|
-
wp_kses_allowed_html( 'post' )
|
|
182
|
-
) . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
|
|
186
|
+
$markup .= '<button aria-label="' . $aria_label . '" class="' . $navigation_child_content_class . ' wp-block-navigation-submenu__toggle" aria-expanded="false">' . $title . '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>' .
|
|
183
187
|
'</button>';
|
|
184
188
|
} else {
|
|
185
|
-
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' .
|
|
186
|
-
$page['title'],
|
|
187
|
-
wp_kses_allowed_html( 'post' )
|
|
188
|
-
) . '</a>';
|
|
189
|
+
$markup .= '<a class="wp-block-pages-list__item__link' . $navigation_child_content_class . '" href="' . esc_url( $page['link'] ) . '"' . $aria_current . '>' . $title . '</a>';
|
|
189
190
|
}
|
|
190
191
|
|
|
191
192
|
if ( isset( $page['children'] ) ) {
|
|
192
193
|
if ( $is_navigation_child && $show_submenu_icons && ! $open_submenus_on_click ) {
|
|
193
|
-
$markup .= '<button class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
194
|
+
$markup .= '<button aria-label="' . $aria_label . '" class="wp-block-navigation__submenu-icon wp-block-navigation-submenu__toggle" aria-expanded="false">';
|
|
194
195
|
$markup .= '<span class="wp-block-page-list__submenu-icon wp-block-navigation__submenu-icon"><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12" fill="none" role="img" aria-hidden="true" focusable="false"><path d="M1.50002 4L6.00002 8L10.5 4" stroke-width="1.5"></path></svg></span>';
|
|
195
196
|
$markup .= '</button>';
|
|
196
197
|
}
|
|
@@ -66,3 +66,20 @@ function register_block_core_post_comments() {
|
|
|
66
66
|
);
|
|
67
67
|
}
|
|
68
68
|
add_action( 'init', 'register_block_core_post_comments' );
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Use the button block classes for the form-submit button.
|
|
72
|
+
*
|
|
73
|
+
* @param array $fields The default comment form arguments.
|
|
74
|
+
*
|
|
75
|
+
* @return array Returns the modified fields.
|
|
76
|
+
*/
|
|
77
|
+
function post_comments_block_form_defaults( $fields ) {
|
|
78
|
+
if ( wp_is_block_theme() ) {
|
|
79
|
+
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
|
|
80
|
+
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return $fields;
|
|
84
|
+
}
|
|
85
|
+
add_filter( 'comment_form_defaults', 'post_comments_block_form_defaults' );
|
|
@@ -64,9 +64,13 @@
|
|
|
64
64
|
}
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
.comment-form
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
.comment-form {
|
|
68
|
+
textarea,
|
|
69
|
+
input:not([type="submit"]):not([type="checkbox"]) {
|
|
70
|
+
display: block;
|
|
71
|
+
box-sizing: border-box;
|
|
72
|
+
width: 100%;
|
|
73
|
+
}
|
|
70
74
|
}
|
|
71
75
|
|
|
72
76
|
.comment-form-cookies-consent {
|
|
@@ -54,10 +54,12 @@ add_action( 'init', 'register_block_core_post_comments_form' );
|
|
|
54
54
|
*
|
|
55
55
|
* @return array Returns the modified fields.
|
|
56
56
|
*/
|
|
57
|
-
function
|
|
58
|
-
|
|
59
|
-
|
|
57
|
+
function post_comments_form_block_form_defaults( $fields ) {
|
|
58
|
+
if ( wp_is_block_theme() ) {
|
|
59
|
+
$fields['submit_button'] = '<input name="%1$s" type="submit" id="%2$s" class="%3$s wp-block-button__link" value="%4$s" />';
|
|
60
|
+
$fields['submit_field'] = '<p class="form-submit wp-block-button">%1$s %2$s</p>';
|
|
61
|
+
}
|
|
60
62
|
|
|
61
63
|
return $fields;
|
|
62
64
|
}
|
|
63
|
-
add_filter( 'comment_form_defaults', '
|
|
65
|
+
add_filter( 'comment_form_defaults', 'post_comments_form_block_form_defaults' );
|
|
@@ -41,13 +41,15 @@
|
|
|
41
41
|
padding: calc(0.667em + 2px); // The extra 2px is added to match outline buttons.
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
.comment-form
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
44
|
+
.comment-form {
|
|
45
|
+
textarea,
|
|
46
|
+
input:not([type="submit"]):not([type="checkbox"]) {
|
|
47
|
+
display: block;
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
width: 100%;
|
|
50
|
+
}
|
|
48
51
|
}
|
|
49
52
|
|
|
50
|
-
.comment-form-comment,
|
|
51
53
|
.comment-form-author,
|
|
52
54
|
.comment-form-email,
|
|
53
55
|
.comment-form-url {
|
package/src/social-links/edit.js
CHANGED
|
@@ -50,17 +50,56 @@ function render_block_core_template_part( $attributes ) {
|
|
|
50
50
|
if ( ! is_wp_error( $area_terms ) && false !== $area_terms ) {
|
|
51
51
|
$area = $area_terms[0]->name;
|
|
52
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* Fires when a block template part is loaded from a template post stored in the database.
|
|
55
|
+
*
|
|
56
|
+
* @since 5.9.0
|
|
57
|
+
*
|
|
58
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
59
|
+
* @param array $attributes The block attributes.
|
|
60
|
+
* @param WP_Post $template_part_post The template part post object.
|
|
61
|
+
* @param string $content The template part content.
|
|
62
|
+
*/
|
|
63
|
+
do_action( 'render_block_core_template_part_post', $template_part_id, $attributes, $template_part_post, $content );
|
|
53
64
|
} else {
|
|
54
65
|
// Else, if the template part was provided by the active theme,
|
|
55
66
|
// render the corresponding file content.
|
|
56
|
-
$
|
|
57
|
-
$
|
|
67
|
+
$parent_theme_folders = get_block_theme_folders( get_template() );
|
|
68
|
+
$child_theme_folders = get_block_theme_folders( get_stylesheet() );
|
|
69
|
+
$child_theme_part_file_path = get_theme_file_path( '/' . $child_theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
|
70
|
+
$parent_theme_part_file_path = get_theme_file_path( '/' . $parent_theme_folders['wp_template_part'] . '/' . $attributes['slug'] . '.html' );
|
|
71
|
+
$template_part_file_path = 0 === validate_file( $attributes['slug'] ) && file_exists( $child_theme_part_file_path ) ? $child_theme_part_file_path : $parent_theme_part_file_path;
|
|
58
72
|
if ( 0 === validate_file( $attributes['slug'] ) && file_exists( $template_part_file_path ) ) {
|
|
59
73
|
$content = file_get_contents( $template_part_file_path );
|
|
60
74
|
$content = is_string( $content ) && '' !== $content
|
|
61
75
|
? _inject_theme_attribute_in_block_template_content( $content )
|
|
62
76
|
: '';
|
|
63
77
|
}
|
|
78
|
+
|
|
79
|
+
if ( '' !== $content && null !== $content ) {
|
|
80
|
+
/**
|
|
81
|
+
* Fires when a block template part is loaded from a template part in the theme.
|
|
82
|
+
*
|
|
83
|
+
* @since 5.9.0
|
|
84
|
+
*
|
|
85
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
86
|
+
* @param array $attributes The block attributes.
|
|
87
|
+
* @param string $template_part_file_path Absolute path to the template path.
|
|
88
|
+
* @param string $content The template part content.
|
|
89
|
+
*/
|
|
90
|
+
do_action( 'render_block_core_template_part_file', $template_part_id, $attributes, $template_part_file_path, $content );
|
|
91
|
+
} else {
|
|
92
|
+
/**
|
|
93
|
+
* Fires when a requested block template part does not exist in the database nor in the theme.
|
|
94
|
+
*
|
|
95
|
+
* @since 5.9.0
|
|
96
|
+
*
|
|
97
|
+
* @param string $template_part_id The requested template part namespaced to the theme.
|
|
98
|
+
* @param array $attributes The block attributes.
|
|
99
|
+
* @param string $template_part_file_path Absolute path to the not found template path.
|
|
100
|
+
*/
|
|
101
|
+
do_action( 'render_block_core_template_part_none', $template_part_id, $attributes, $template_part_file_path );
|
|
102
|
+
}
|
|
64
103
|
}
|
|
65
104
|
}
|
|
66
105
|
|