From 56924a76c279130ce8a631d67c73cf37bec93e69 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Tue, 22 Feb 2022 13:43:51 +0000 Subject: [PATCH 1/2] Post Title: Add support for text decoration --- packages/block-library/src/post-title/block.json | 1 + packages/block-library/src/post-title/index.php | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-title/block.json b/packages/block-library/src/post-title/block.json index d17ad5cc0e93ab..2fd03ef784a843 100644 --- a/packages/block-library/src/post-title/block.json +++ b/packages/block-library/src/post-title/block.json @@ -50,6 +50,7 @@ "__experimentalFontFamily": true, "__experimentalFontWeight": true, "__experimentalFontStyle": true, + "__experimentalTextDecoration": true, "__experimentalTextTransform": true, "__experimentalLetterSpacing": true, "__experimentalDefaultControls": { diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index 78f1e859fbffa9..da80cdbbac4e66 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -33,10 +33,19 @@ function render_block_core_post_title( $attributes, $content, $block ) { $tag_name = 0 === $attributes['level'] ? 'p' : 'h' . $attributes['level']; } + $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); + if ( isset( $attributes['isLink'] ) && $attributes['isLink'] ) { - $title = sprintf( '%4$s', get_the_permalink( $post_ID ), esc_attr( $attributes['linkTarget'] ), esc_attr( $attributes['rel'] ), $title ); + return sprintf( + '<%1$s>%6$s', + $tag_name, + get_the_permalink( $post_ID ), + $attributes['linkTarget'], + $attributes['rel'], + $wrapper_attributes, + $title + ); } - $wrapper_attributes = get_block_wrapper_attributes( array( 'class' => $align_class_name ) ); return sprintf( '<%1$s %2$s>%3$s', From 53ffbd0a7bd8eab573dbabae9a28b1b076f1dba8 Mon Sep 17 00:00:00 2001 From: Ben Dwyer Date: Tue, 22 Feb 2022 17:04:13 +0000 Subject: [PATCH 2/2] restore output escaping --- packages/block-library/src/post-title/index.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-library/src/post-title/index.php b/packages/block-library/src/post-title/index.php index da80cdbbac4e66..a881f9e1f10f94 100644 --- a/packages/block-library/src/post-title/index.php +++ b/packages/block-library/src/post-title/index.php @@ -40,8 +40,8 @@ function render_block_core_post_title( $attributes, $content, $block ) { '<%1$s>%6$s', $tag_name, get_the_permalink( $post_ID ), - $attributes['linkTarget'], - $attributes['rel'], + esc_attr( $attributes['linkTarget'] ), + esc_attr( $attributes['rel'] ), $wrapper_attributes, $title );