File tree Expand file tree Collapse file tree 1 file changed +23
-8
lines changed
packages/block-library/src/tab Expand file tree Collapse file tree 1 file changed +23
-8
lines changed Original file line number Diff line number Diff line change @@ -9,12 +9,32 @@ import clsx from 'clsx';
99import { __ , sprintf } from '@wordpress/i18n' ;
1010import { RichText } from '@wordpress/block-editor' ;
1111import { decodeEntities } from '@wordpress/html-entities' ;
12+ import { RawHTML } from '@wordpress/element' ;
1213
1314/**
1415 * Internal dependencies
1516 */
1617import slugFromLabel from './slug-from-label' ;
1718
19+ function StaticLabel ( { label, index } ) {
20+ if ( label ) {
21+ return (
22+ < span >
23+ < RawHTML > { decodeEntities ( label ) } </ RawHTML >
24+ </ span >
25+ ) ;
26+ }
27+ return (
28+ < span >
29+ { sprintf (
30+ /* translators: %d is the tab index + 1 */
31+ __ ( 'Tab %d' ) ,
32+ index + 1
33+ ) }
34+ </ span >
35+ ) ;
36+ }
37+
1838export default function TabsList ( {
1939 siblingTabs,
2040 currentClientId,
@@ -89,14 +109,9 @@ export default function TabsList( {
89109 onChange = { onLabelChange }
90110 />
91111 ) : (
92- < RichText . Content
93- value = { decodeEntities ( siblingLabel ) }
94- tagName = "span"
95- placeholder = { sprintf (
96- /* translators: %d is the tab index + 1 */
97- __ ( 'Tab %d…' ) ,
98- index + 1
99- ) }
112+ < StaticLabel
113+ label = { siblingLabel }
114+ index = { index }
100115 />
101116 ) }
102117 </ button >
You can’t perform that action at this time.
0 commit comments