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
2 changes: 1 addition & 1 deletion docs/reference-guides/core-blocks.md
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ Displays the name of this site. Update the block, and the changes apply everywhe
- **Name:** core/site-title
- **Category:** theme
- **Supports:** align (full, wide), color (background, gradients, link, text), interactivity (clientNavigation), spacing (margin, padding), typography (fontSize, lineHeight), ~~html~~
- **Attributes:** isLink, level, linkTarget, textAlign
- **Attributes:** isLink, level, levelOptions, linkTarget, textAlign

## Social Icon

Expand Down
4 changes: 4 additions & 0 deletions packages/block-library/src/site-title/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
"type": "number",
"default": 1
},
"levelOptions": {
"type": "array",
"default": [ 0, 1, 2, 3, 4, 5, 6 ]
},
"textAlign": {
"type": "string"
},
Expand Down
6 changes: 2 additions & 4 deletions packages/block-library/src/site-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,12 @@ import { ToggleControl, PanelBody } from '@wordpress/components';
import { createBlock, getDefaultBlockName } from '@wordpress/blocks';
import { decodeEntities } from '@wordpress/html-entities';

const HEADING_LEVELS = [ 0, 1, 2, 3, 4, 5, 6 ];

export default function SiteTitleEdit( {
attributes,
setAttributes,
insertBlocksAfter,
} ) {
const { level, textAlign, isLink, linkTarget } = attributes;
const { level, levelOptions, textAlign, isLink, linkTarget } = attributes;
const { canUserEdit, title } = useSelect( ( select ) => {
const { canUser, getEntityRecord, getEditedEntityRecord } =
select( coreStore );
Expand Down Expand Up @@ -97,8 +95,8 @@ export default function SiteTitleEdit( {
<>
<BlockControls group="block">
<HeadingLevelDropdown
options={ HEADING_LEVELS }
value={ level }
options={ levelOptions }
onChange={ ( newLevel ) =>
setAttributes( { level: newLevel } )
}
Expand Down
1 change: 1 addition & 0 deletions test/integration/fixtures/blocks/core__site-title.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"isValid": true,
"attributes": {
"level": 1,
"levelOptions": [ 0, 1, 2, 3, 4, 5, 6 ],
"isLink": true,
"linkTarget": "_self"
},
Expand Down