diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index dfe0f224c8f360..8f66a3f9f2171e 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -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 diff --git a/packages/block-library/src/site-title/block.json b/packages/block-library/src/site-title/block.json index 95d8deb1e43b9d..c75b1bc229beb9 100644 --- a/packages/block-library/src/site-title/block.json +++ b/packages/block-library/src/site-title/block.json @@ -11,6 +11,10 @@ "type": "number", "default": 1 }, + "levelOptions": { + "type": "array", + "default": [ 0, 1, 2, 3, 4, 5, 6 ] + }, "textAlign": { "type": "string" }, diff --git a/packages/block-library/src/site-title/edit.js b/packages/block-library/src/site-title/edit.js index 76519ac1297b14..82e3c1d7f7bb40 100644 --- a/packages/block-library/src/site-title/edit.js +++ b/packages/block-library/src/site-title/edit.js @@ -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 ); @@ -97,8 +95,8 @@ export default function SiteTitleEdit( { <> setAttributes( { level: newLevel } ) } diff --git a/test/integration/fixtures/blocks/core__site-title.json b/test/integration/fixtures/blocks/core__site-title.json index 12f32615473cc8..8ca7091f30d5e7 100644 --- a/test/integration/fixtures/blocks/core__site-title.json +++ b/test/integration/fixtures/blocks/core__site-title.json @@ -4,6 +4,7 @@ "isValid": true, "attributes": { "level": 1, + "levelOptions": [ 0, 1, 2, 3, 4, 5, 6 ], "isLink": true, "linkTarget": "_self" },