From c718590cdf4c5a6910f3bed5dc7295eafb53a07c Mon Sep 17 00:00:00 2001 From: Arthur Normand Date: Thu, 4 Apr 2024 19:43:38 -0400 Subject: [PATCH 1/3] Enable justifying text --- .../block-editor/src/components/alignment-control/ui.js | 7 ++++++- packages/block-library/src/common.scss | 5 +++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/alignment-control/ui.js b/packages/block-editor/src/components/alignment-control/ui.js index b41cb4b0d2520..cd2f8cb2fec20 100644 --- a/packages/block-editor/src/components/alignment-control/ui.js +++ b/packages/block-editor/src/components/alignment-control/ui.js @@ -3,7 +3,7 @@ */ import { __, isRTL } from '@wordpress/i18n'; import { ToolbarDropdownMenu, ToolbarGroup } from '@wordpress/components'; -import { alignLeft, alignRight, alignCenter } from '@wordpress/icons'; +import {alignLeft, alignRight, alignCenter, alignJustify} from '@wordpress/icons'; const DEFAULT_ALIGNMENT_CONTROLS = [ { @@ -21,6 +21,11 @@ const DEFAULT_ALIGNMENT_CONTROLS = [ title: __( 'Align text right' ), align: 'right', }, + { + icon: alignJustify, + title: __( 'Justify text' ), + align: 'justify', + } ]; const POPOVER_PROPS = { diff --git a/packages/block-library/src/common.scss b/packages/block-library/src/common.scss index 2e1c2b8b706bc..5ad0d5fc77b2c 100644 --- a/packages/block-library/src/common.scss +++ b/packages/block-library/src/common.scss @@ -46,6 +46,11 @@ text-align: right; } +.has-text-align-justify { + /*rtl:ignore*/ + text-align: justify; +} + // This tag marks the end of the styles that apply to editing canvas contents and need to be manipulated when we resize the editor. #end-resizable-editor-section { display: none; From aa8ee6bcf7ff093cd9f201f0db5fb3e4a0fa457c Mon Sep 17 00:00:00 2001 From: Arthur Normand Date: Thu, 4 Apr 2024 20:16:46 -0400 Subject: [PATCH 2/3] Fix prettier --- packages/block-editor/src/components/alignment-control/ui.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/block-editor/src/components/alignment-control/ui.js b/packages/block-editor/src/components/alignment-control/ui.js index cd2f8cb2fec20..0241fec949bc0 100644 --- a/packages/block-editor/src/components/alignment-control/ui.js +++ b/packages/block-editor/src/components/alignment-control/ui.js @@ -3,7 +3,7 @@ */ import { __, isRTL } from '@wordpress/i18n'; import { ToolbarDropdownMenu, ToolbarGroup } from '@wordpress/components'; -import {alignLeft, alignRight, alignCenter, alignJustify} from '@wordpress/icons'; +import { alignLeft, alignRight, alignCenter, alignJustify } from '@wordpress/icons'; const DEFAULT_ALIGNMENT_CONTROLS = [ { @@ -25,7 +25,7 @@ const DEFAULT_ALIGNMENT_CONTROLS = [ icon: alignJustify, title: __( 'Justify text' ), align: 'justify', - } + }, ]; const POPOVER_PROPS = { From e9a11d269701163e5c0b1220eca5379a2a3a69eb Mon Sep 17 00:00:00 2001 From: Arthur Normand Date: Thu, 4 Apr 2024 20:29:33 -0400 Subject: [PATCH 3/3] Update alignment control snapshot --- .../test/__snapshots__/index.js.snap | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap b/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap index f2915ead7417b..020275f41cd75 100644 --- a/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap +++ b/packages/block-editor/src/components/alignment-control/test/__snapshots__/index.js.snap @@ -164,6 +164,29 @@ exports[`AlignmentUI should match snapshot when controls are visible 1`] = ` +
+ +
`;