From 6272e784c35640356881d1a1c1353e9c5937368d Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Fri, 2 Aug 2024 16:44:27 +0900 Subject: [PATCH 1/6] Quote Block: Add align support --- docs/reference-guides/core-blocks.md | 2 +- packages/block-library/src/quote/block.json | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/reference-guides/core-blocks.md b/docs/reference-guides/core-blocks.md index 72281a53c3dd18..5cf53acbf6e807 100644 --- a/docs/reference-guides/core-blocks.md +++ b/docs/reference-guides/core-blocks.md @@ -783,7 +783,7 @@ Give quoted text visual emphasis. "In quoting others, we cite ourselves." — Ju - **Name:** core/quote - **Category:** text -- **Supports:** anchor, background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ +- **Supports:** align (full, left, right, wide), anchor, background (backgroundImage, backgroundSize), color (background, gradients, heading, link, text), dimensions (minHeight), interactivity (clientNavigation), layout (~~allowEditing~~), spacing (blockGap, margin, padding), typography (fontSize, lineHeight), ~~html~~ - **Attributes:** citation, textAlign, value ## Read More diff --git a/packages/block-library/src/quote/block.json b/packages/block-library/src/quote/block.json index c695c938923ae7..0f9ec97422f64b 100644 --- a/packages/block-library/src/quote/block.json +++ b/packages/block-library/src/quote/block.json @@ -28,6 +28,7 @@ }, "supports": { "anchor": true, + "align": [ "left", "right", "wide", "full" ], "html": false, "background": { "backgroundImage": true, From 52452f7ea8cb6d1656706852468f8f92b5a06be1 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Sat, 3 Aug 2024 08:54:38 +0900 Subject: [PATCH 2/6] Inherit alignment when transforming from pullquote block --- packages/block-library/src/quote/transforms.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/quote/transforms.js b/packages/block-library/src/quote/transforms.js index f9b3970433fad6..787eed98a040d2 100644 --- a/packages/block-library/src/quote/transforms.js +++ b/packages/block-library/src/quote/transforms.js @@ -9,10 +9,18 @@ const transforms = { { type: 'block', blocks: [ 'core/pullquote' ], - transform: ( { value, citation, anchor, fontSize, style } ) => { + transform: ( { + value, + align, + citation, + anchor, + fontSize, + style, + } ) => { return createBlock( 'core/quote', { + align, citation, anchor, fontSize, From 6c44776380832dfe140fe9ad88ba7e7806132530 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Sat, 3 Aug 2024 09:07:03 +0900 Subject: [PATCH 3/6] Inherit alignment when transforming to pullquote block --- packages/block-library/src/quote/transforms.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/block-library/src/quote/transforms.js b/packages/block-library/src/quote/transforms.js index 787eed98a040d2..c960759691bf16 100644 --- a/packages/block-library/src/quote/transforms.js +++ b/packages/block-library/src/quote/transforms.js @@ -103,7 +103,7 @@ const transforms = { ); }, transform: ( - { citation, anchor, fontSize, style }, + { align, citation, anchor, fontSize, style }, innerBlocks ) => { const value = innerBlocks @@ -111,6 +111,7 @@ const transforms = { .join( '
' ); return createBlock( 'core/pullquote', { value, + align, citation, anchor, fontSize, From 164cb72797132bc7a2becb80adf009dcda192a46 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Sat, 3 Aug 2024 09:09:23 +0900 Subject: [PATCH 4/6] Try to fix mobile unit test --- packages/components/src/mobile/utils/alignments.native.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/mobile/utils/alignments.native.js b/packages/components/src/mobile/utils/alignments.native.js index bc42385988a5d1..f1f737d7ed367a 100644 --- a/packages/components/src/mobile/utils/alignments.native.js +++ b/packages/components/src/mobile/utils/alignments.native.js @@ -13,6 +13,7 @@ export const WIDE_ALIGNMENTS = { 'core/image', 'core/separator', 'core/media-text', + 'core/quote', 'core/pullquote', ], }; From 9d5a0bf0f41b79effba2bbfa088cff9c76c399ea Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Tue, 13 Aug 2024 18:25:42 +0900 Subject: [PATCH 5/6] Try to fix mobile unit test --- packages/block-library/src/quote/test/transforms.native.js | 2 +- packages/components/src/mobile/utils/alignments.native.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/block-library/src/quote/test/transforms.native.js b/packages/block-library/src/quote/test/transforms.native.js index 25030e0a018d41..3d2bc8ae609182 100644 --- a/packages/block-library/src/quote/test/transforms.native.js +++ b/packages/block-library/src/quote/test/transforms.native.js @@ -14,7 +14,7 @@ import { const block = 'Quote'; const initialHtml = ` - +

"This will make running your own blog a viable alternative again."

Adrian Zumbrunnen
diff --git a/packages/components/src/mobile/utils/alignments.native.js b/packages/components/src/mobile/utils/alignments.native.js index f1f737d7ed367a..bc42385988a5d1 100644 --- a/packages/components/src/mobile/utils/alignments.native.js +++ b/packages/components/src/mobile/utils/alignments.native.js @@ -13,7 +13,6 @@ export const WIDE_ALIGNMENTS = { 'core/image', 'core/separator', 'core/media-text', - 'core/quote', 'core/pullquote', ], }; From ce854ca77d65acb6178ddd7a1799f18cc2b93152 Mon Sep 17 00:00:00 2001 From: Aki Hamano Date: Tue, 13 Aug 2024 18:31:32 +0900 Subject: [PATCH 6/6] Try to fix mobile unit test --- packages/components/src/mobile/utils/alignments.native.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/components/src/mobile/utils/alignments.native.js b/packages/components/src/mobile/utils/alignments.native.js index bc42385988a5d1..f1f737d7ed367a 100644 --- a/packages/components/src/mobile/utils/alignments.native.js +++ b/packages/components/src/mobile/utils/alignments.native.js @@ -13,6 +13,7 @@ export const WIDE_ALIGNMENTS = { 'core/image', 'core/separator', 'core/media-text', + 'core/quote', 'core/pullquote', ], };