Skip to content

Commit

Permalink
Post title: Re-add the paragraph level (without UI) (#60548)
Browse files Browse the repository at this point in the history
* Post title: Re-add the paragraph level (without UI).

Co-authored-by: carolinan <[email protected]>
Co-authored-by: andrewserong <[email protected]>
Co-authored-by: t-hamano <[email protected]>
Co-authored-by: alexstine <[email protected]>
Co-authored-by: afercia <[email protected]>
Co-authored-by: jorgefilipecosta <[email protected]>
Co-authored-by: jordesign <[email protected]>
Co-authored-by: mrwweb <[email protected]>
  • Loading branch information
9 people authored Apr 12, 2024
1 parent 7c41cb0 commit 690d933
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default function PostTitleEdit( {
context: { postType, postId, queryId },
insertBlocksAfter,
} ) {
const TagName = 'h' + level;
const TagName = level === 0 ? 'p' : `h${ level }`;
const isDescendentOfQueryLoop = Number.isFinite( queryId );
const userCanEdit = useSelect(
( select ) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/post-title/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function render_block_core_post_title( $attributes, $content, $block ) {

$tag_name = 'h2';
if ( isset( $attributes['level'] ) ) {
$tag_name = 'h' . $attributes['level'];
$tag_name = 0 === $attributes['level'] ? 'p' : 'h' . (int) $attributes['level'];
}

if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) {
Expand Down

0 comments on commit 690d933

Please sign in to comment.