From 51c2aefc2767ddb988742ed4745a0c1dea2e2c5d Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Sun, 25 Sep 2022 12:18:18 +0900 Subject: [PATCH 1/4] Archive Block: Prevent block support styles and additional CSS classes from being printed twice --- packages/block-library/src/archives/edit.js | 13 ++++++++++++- packages/block-library/src/archives/style.scss | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/archives/edit.js b/packages/block-library/src/archives/edit.js index c89b5894ed6ed..a9e5ba4c17418 100644 --- a/packages/block-library/src/archives/edit.js +++ b/packages/block-library/src/archives/edit.js @@ -14,6 +14,17 @@ import ServerSideRender from '@wordpress/server-side-render'; export default function ArchivesEdit( { attributes, setAttributes } ) { const { showLabel, showPostCounts, displayAsDropdown, type } = attributes; + // Prevent block support styles and additional CSS classes from being printed twice. + const serverSideRenderAttirbutes = { + ...attributes, + className: undefined, + style: { + ...attributes.style, + spacing: undefined, + typography: undefined, + }, + }; + return ( <> @@ -66,7 +77,7 @@ export default function ArchivesEdit( { attributes, setAttributes } ) { diff --git a/packages/block-library/src/archives/style.scss b/packages/block-library/src/archives/style.scss index 4f575b6d8db8c..15cd315e0aaf1 100644 --- a/packages/block-library/src/archives/style.scss +++ b/packages/block-library/src/archives/style.scss @@ -1,3 +1,8 @@ +.wp-block-archives { + // This block has customizable padding, border-box makes that more predictable. + box-sizing: border-box; +} + .wp-block-archives-dropdown { label { display: block; From 02ceb06e49cb025fa702520d8b8e59fcfbaaab22 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 26 Sep 2022 17:59:52 +0900 Subject: [PATCH 2/4] Fix Typo Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --- packages/block-library/src/archives/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/archives/edit.js b/packages/block-library/src/archives/edit.js index a9e5ba4c17418..0c653d71caca7 100644 --- a/packages/block-library/src/archives/edit.js +++ b/packages/block-library/src/archives/edit.js @@ -15,7 +15,7 @@ export default function ArchivesEdit( { attributes, setAttributes } ) { const { showLabel, showPostCounts, displayAsDropdown, type } = attributes; // Prevent block support styles and additional CSS classes from being printed twice. - const serverSideRenderAttirbutes = { + const serverSideRenderAttributes = { ...attributes, className: undefined, style: { From 7a7ba0fd1515f718e3f0f2f96abbe4c2f11bb934 Mon Sep 17 00:00:00 2001 From: Aki Hamano <54422211+t-hamano@users.noreply.github.com> Date: Mon, 26 Sep 2022 18:00:00 +0900 Subject: [PATCH 3/4] Fix Typo Co-authored-by: Aaron Robertshaw <60436221+aaronrobertshaw@users.noreply.github.com> --- packages/block-library/src/archives/edit.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-library/src/archives/edit.js b/packages/block-library/src/archives/edit.js index 0c653d71caca7..71498a11aad9a 100644 --- a/packages/block-library/src/archives/edit.js +++ b/packages/block-library/src/archives/edit.js @@ -77,7 +77,7 @@ export default function ArchivesEdit( { attributes, setAttributes } ) { From a6f8bb6d4f5d4ecc3907cfcb3d10507613ed6075 Mon Sep 17 00:00:00 2001 From: Tetsuaki Hamano Date: Fri, 7 Oct 2022 18:33:14 +0900 Subject: [PATCH 4/4] Use new option --- packages/block-library/src/archives/edit.js | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/packages/block-library/src/archives/edit.js b/packages/block-library/src/archives/edit.js index 71498a11aad9a..118fa5cfa2d1a 100644 --- a/packages/block-library/src/archives/edit.js +++ b/packages/block-library/src/archives/edit.js @@ -14,17 +14,6 @@ import ServerSideRender from '@wordpress/server-side-render'; export default function ArchivesEdit( { attributes, setAttributes } ) { const { showLabel, showPostCounts, displayAsDropdown, type } = attributes; - // Prevent block support styles and additional CSS classes from being printed twice. - const serverSideRenderAttributes = { - ...attributes, - className: undefined, - style: { - ...attributes.style, - spacing: undefined, - typography: undefined, - }, - }; - return ( <> @@ -77,7 +66,8 @@ export default function ArchivesEdit( { attributes, setAttributes } ) {