Skip to content

Commit 4710b87

Browse files
shimotmkshimotmkt-hamano
authored
Add levelOptions attribute to Term Name block. (WordPress#73005)
Co-authored-by: shimotmk <[email protected]> Co-authored-by: t-hamano <[email protected]>
1 parent 126f741 commit 4710b87

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

docs/reference-guides/core-blocks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ Displays the name of a taxonomy term. ([Source](https://github.com/WordPress/gut
10391039
- **Name:** core/term-name
10401040
- **Category:** theme
10411041
- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (padding), typography (fontSize, lineHeight), ~~html~~
1042-
- **Attributes:** isLink, level, textAlign
1042+
- **Attributes:** isLink, level, levelOptions, textAlign
10431043

10441044
## Term Template
10451045

packages/block-library/src/term-name/block.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"isLink": {
2020
"type": "boolean",
2121
"default": false
22+
},
23+
"levelOptions": {
24+
"type": "array"
2225
}
2326
},
2427
"supports": {

packages/block-library/src/term-name/edit.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export default function TermNameEdit( {
3232
setAttributes,
3333
context: { termId, taxonomy },
3434
} ) {
35-
const { textAlign, level = 0, isLink } = attributes;
35+
const { textAlign, level = 0, isLink, levelOptions } = attributes;
3636
const { term } = useTermName( termId, taxonomy );
3737

3838
const termName = term?.name
@@ -66,7 +66,7 @@ export default function TermNameEdit( {
6666
<BlockControls group="block">
6767
<HeadingLevelDropdown
6868
value={ level }
69-
options={ [ 0, 1, 2, 3, 4, 5, 6 ] }
69+
options={ levelOptions }
7070
onChange={ ( newLevel ) => {
7171
setAttributes( { level: newLevel } );
7272
} }

0 commit comments

Comments
 (0)