PluginProbe
Gutenberg / 24.1.0
Gutenberg v24.1.0
24.1.0 24.0.0 23.9.1 23.9.0 23.8.0 23.7.2 23.7.1 23.7.0 23.6.1 23.6.2 23.6.0 23.5.3 23.5.2 23.5.1 23.5.0 23.4.0 23.3.2 23.3.1 23.3.0 23.2.0 23.2.1 23.2.2 23.1.1 23.1.0 23.0.1 All 404 releases
← All changes | build/scripts/block-library/tabs.php +7 -6 23.5.2 → 24.1.0 View file →
@@ -20,9 +20,9 @@
20 20
21 21 // Find tab-panel block
22 22 foreach ( $innerblocks as $inner_block ) {
23 23 if ( 'core/tab-panels' === ( $inner_block['blockName'] ?? '' ) ) {
24 - $tab_index = 0;
24 + $tab_number = 1;
25 25 foreach ( $inner_block['innerBlocks'] ?? array() as $tab_block ) {
26 26 if ( 'core/tab-panel' === ( $tab_block['blockName'] ?? '' ) ) {
27 27 $attrs = $tab_block['attrs'] ?? array();
28 28
@@ -28,13 +28,13 @@
28 28
29 29 $tab_id = ! empty( $attrs['anchor'] )
30 30 ? $attrs['anchor']
31 31 : ( ! empty( $tabs_id )
32 - ? $tabs_id . '-tab-' . $tab_index
33 - : 'tab-' . $tab_index );
32 + ? $tabs_id . '-tab-' . $tab_number
33 + : 'tab-' . $tab_number );
34 34
35 35 $tabs_list[] = esc_attr( $tab_id );
36 - ++$tab_index;
36 + ++$tab_number;
37 37 }
38 38 }
39 39 break;
40 40 }
@@ -58,9 +58,9 @@
58 58 function gutenberg_block_core_tabs_provide_context( array $context, array $parsed_block ): array {
59 59 if ( 'core/tabs' === $parsed_block['blockName'] ) {
60 60 // Generate a unique ID for the tabs instance first, so it can be used
61 61 // to derive stable tab IDs.
62 - $tabs_id = $parsed_block['attrs']['anchor'] ?? wp_unique_id( 'tabs_' );
62 + $tabs_id = $parsed_block['attrs']['anchor'] ?? wp_unique_prefixed_id( 'tabs_' );
63 63 $tabs_list = gutenberg_block_core_tabs_generate_tabs_list( $parsed_block['innerBlocks'] ?? array(), $tabs_id );
64 64 $context['core/tabs-list'] = $tabs_list;
65 65 $context['core/tabs-id'] = $tabs_id;
66 66 }
@@ -103,9 +103,10 @@
103 103 'activeTabIndex' => $active_tab_index,
104 104 )
105 105 )
106 106 );
107 - $tag_processor->set_attribute( 'data-wp-init', 'callbacks.onTabsInit' );
107 + $tag_processor->set_attribute( 'data-wp-init', 'callbacks.activateTabByHash' );
108 + $tag_processor->set_attribute( 'data-wp-on-window--hashchange', 'callbacks.activateTabByHash' );
108 109 $tag_processor->set_attribute( 'data-wp-on--keydown', 'actions.handleTabKeyDown' );
109 110
110 111 $output = $tag_processor->get_updated_html();
111 112