From 88a91765b16ae17b00dbe2cc7fc6e8ae73249a76 Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 16 Aug 2024 06:05:05 +0900 Subject: [PATCH 1/3] Fix in Author block --- packages/block-library/src/editor.scss | 1 + .../block-library/src/post-author/block.json | 1 + .../block-library/src/post-author/edit.js | 125 ++++++++++-------- .../block-library/src/post-author/editor.scss | 7 + 4 files changed, 76 insertions(+), 58 deletions(-) create mode 100644 packages/block-library/src/post-author/editor.scss diff --git a/packages/block-library/src/editor.scss b/packages/block-library/src/editor.scss index 52f3aa64287fa..0669a082b1086 100644 --- a/packages/block-library/src/editor.scss +++ b/packages/block-library/src/editor.scss @@ -31,6 +31,7 @@ @import "./nextpage/editor.scss"; @import "./page-list/editor.scss"; @import "./paragraph/editor.scss"; +@import "./post-author/editor.scss"; @import "./post-excerpt/editor.scss"; @import "./pullquote/editor.scss"; @import "./rss/editor.scss"; diff --git a/packages/block-library/src/post-author/block.json b/packages/block-library/src/post-author/block.json index 6f814810744c6..dde9320841820 100644 --- a/packages/block-library/src/post-author/block.json +++ b/packages/block-library/src/post-author/block.json @@ -66,5 +66,6 @@ "clientNavigation": true } }, + "editorStyle": "wp-block-post-author-editor", "style": "wp-block-post-author" } diff --git a/packages/block-library/src/post-author/edit.js b/packages/block-library/src/post-author/edit.js index 1bc1ef4ffcd8a..6186b0d052e8a 100644 --- a/packages/block-library/src/post-author/edit.js +++ b/packages/block-library/src/post-author/edit.js @@ -18,6 +18,7 @@ import { PanelBody, SelectControl, ToggleControl, + __experimentalVStack as VStack, } from '@wordpress/components'; import { useSelect, useDispatch } from '@wordpress/data'; import { __ } from '@wordpress/i18n'; @@ -100,74 +101,82 @@ function PostAuthorEdit( { <> - { showAuthorControl && - ( ( showCombobox && ( - - ) ) || ( + + { showAuthorControl && + ( ( showCombobox && ( + + ) ) || ( + + ) ) } + + setAttributes( { showAvatar: ! showAvatar } ) + } + /> + { showAvatar && ( { + setAttributes( { + avatarSize: Number( size ), + } ); + } } /> - ) ) } - - setAttributes( { showAvatar: ! showAvatar } ) - } - /> - { showAvatar && ( - { - setAttributes( { - avatarSize: Number( size ), - } ); - } } + label={ __( 'Show bio' ) } + checked={ showBio } + onChange={ () => + setAttributes( { showBio: ! showBio } ) + } /> - ) } - - setAttributes( { showBio: ! showBio } ) - } - /> - setAttributes( { isLink: ! isLink } ) } - /> - { isLink && ( - setAttributes( { - linkTarget: value ? '_blank' : '_self', - } ) + label={ __( 'Link author name to author page' ) } + checked={ isLink } + onChange={ () => + setAttributes( { isLink: ! isLink } ) } - checked={ linkTarget === '_blank' } /> - ) } + { isLink && ( + + setAttributes( { + linkTarget: value ? '_blank' : '_self', + } ) + } + checked={ linkTarget === '_blank' } + /> + ) } + diff --git a/packages/block-library/src/post-author/editor.scss b/packages/block-library/src/post-author/editor.scss new file mode 100644 index 0000000000000..f6464893138cf --- /dev/null +++ b/packages/block-library/src/post-author/editor.scss @@ -0,0 +1,7 @@ +.wp-block-post-author__inspector-settings { + // Counteract the margin added by the block inspector. + .components-base-control, + .components-base-control:last-child { + margin-bottom: 0; + } +} From b00f9a41b431f8859ff895813a830154a4f9521a Mon Sep 17 00:00:00 2001 From: Lena Morita Date: Fri, 16 Aug 2024 06:07:07 +0900 Subject: [PATCH 2/3] Fix in Avatar block --- packages/block-library/src/avatar/user-control.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/block-library/src/avatar/user-control.js b/packages/block-library/src/avatar/user-control.js index 598c05011eaed..235202ffec90d 100644 --- a/packages/block-library/src/avatar/user-control.js +++ b/packages/block-library/src/avatar/user-control.js @@ -33,6 +33,7 @@ function UserControl( { value, onChange } ) { return ( Date: Fri, 16 Aug 2024 06:07:16 +0900 Subject: [PATCH 3/3] Add lint rule --- .eslintrc.js | 1 + 1 file changed, 1 insertion(+) diff --git a/.eslintrc.js b/.eslintrc.js index 2cdbb5c056cb1..c2a0d1f18ab6b 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -313,6 +313,7 @@ module.exports = { ...[ 'BorderBoxControl', 'BorderControl', + 'ComboboxControl', 'DimensionControl', 'FontSizePicker', 'ToggleGroupControl',