diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index 4142f4cb1d887..da9e1dc8c3978 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -5,7 +5,26 @@ "postId", "postType" ], + "attributes": { + "align": { + "type": "string" + }, + "level": { + "type": "number", + "default": 2 + } + }, "supports": { - "html": false + "html": false, + "lightBlockWrapper": true, + "__experimentalSelector": { + "core/post-title/h1": "h1", + "core/post-title/h2": "h2", + "core/post-title/h3": "h3", + "core/post-title/h4": "h4", + "core/post-title/h5": "h5", + "core/post-title/h6": "h6", + "core/post-title/p": "p" + } } } diff --git a/packages/block-library/src/post-title/edit.js b/packages/block-library/src/post-title/edit.js index e06cdddee244a..a954e93cd0a3d 100644 --- a/packages/block-library/src/post-title/edit.js +++ b/packages/block-library/src/post-title/edit.js @@ -1,10 +1,32 @@ +/** + * External dependencies + */ +import classnames from 'classnames'; + /** * WordPress dependencies */ import { useSelect } from '@wordpress/data'; +import { + AlignmentToolbar, + BlockControls, + __experimentalBlock as Block, +} from '@wordpress/block-editor'; +import { ToolbarGroup } from '@wordpress/components'; -export default function PostTitleEdit( { context } ) { +/** + * Internal dependencies + */ +import HeadingLevelDropdown from '../heading/heading-level-dropdown'; + +export default function PostTitleEdit( { + attributes, + setAttributes, + context, +} ) { + const { level, align } = attributes; const { postType, postId } = context; + const tagName = 0 === level ? 'p' : 'h' + level; const post = useSelect( ( select ) => @@ -20,5 +42,32 @@ export default function PostTitleEdit( { context } ) { return null; } - return