Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 3 additions & 6 deletions packages/block-library/src/tab/add-tab-toolbar-control.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* WordPress dependencies
*/
import { sprintf, __ } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import { createBlock } from '@wordpress/blocks';
import {
BlockControls,
Expand All @@ -22,13 +22,12 @@ import { useDispatch, useSelect } from '@wordpress/data';
export default function AddTabToolbarControl( { tabsClientId } ) {
const { insertBlock } = useDispatch( blockEditorStore );

const { tabPanelClientId, tabsMenuClientId, tabCount } = useSelect(
const { tabPanelClientId, tabsMenuClientId } = useSelect(
( select ) => {
if ( ! tabsClientId ) {
return {
tabPanelClientId: null,
tabsMenuClientId: null,
tabCount: 0,
};
}
const { getBlocks } = select( blockEditorStore );
Expand All @@ -42,7 +41,6 @@ export default function AddTabToolbarControl( { tabsClientId } ) {
return {
tabPanelClientId: tabPanel?.clientId || null,
tabsMenuClientId: tabsMenu?.clientId || null,
tabCount: tabPanel?.innerBlocks?.length || 0,
};
},
[ tabsClientId ]
Expand All @@ -54,8 +52,7 @@ export default function AddTabToolbarControl( { tabsClientId } ) {
}

const newTabBlock = createBlock( 'core/tab', {
/* translators: %d: tab number */
label: sprintf( __( 'Tab %d' ), tabCount + 1 ),
label: __( 'Tab' ),
} );
insertBlock( newTabBlock, undefined, tabPanelClientId );

Expand Down
8 changes: 2 additions & 6 deletions packages/block-library/src/tabs-menu-item/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import clsx from 'clsx';
/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';
import { __ } from '@wordpress/i18n';
import {
useBlockProps,
store as blockEditorStore,
Expand Down Expand Up @@ -138,11 +138,7 @@ function Edit( {
<RichText
tagName="span"
withoutInteractiveFormatting
placeholder={ sprintf(
/* translators: %d is the tab index + 1 */
__( 'Tab title %d' ),
menuItemIndex + 1
) }
placeholder={ __( 'Tab title' ) }
value={ label }
onChange={ handleLabelChange }
/>
Expand Down
5 changes: 3 additions & 2 deletions packages/block-library/src/tabs/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
} from '@wordpress/block-editor';
import { useSelect, useDispatch } from '@wordpress/data';
import { useMemo, useEffect, useRef } from '@wordpress/element';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
Expand Down Expand Up @@ -41,14 +42,14 @@ const TABS_TEMPLATE = [
[
'core/tab',
{
label: 'Tab 1',
label: __( 'Tab' ),
},
[ [ 'core/paragraph' ] ],
],
[
'core/tab',
{
label: 'Tab 2',
label: __( 'Tab' ),
},
[ [ 'core/paragraph' ] ],
],
Expand Down
Loading