Skip to content

Commit

Permalink
Revert "Try ToggleGroupControl for text columns"
Browse files Browse the repository at this point in the history
This reverts commit 72703988d669f02af227a3db7f9cb053f4a25feb.
  • Loading branch information
aaronrobertshaw committed Feb 7, 2023
1 parent 7c61aab commit 3dcaab9
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 154 deletions.
1 change: 0 additions & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export { default as __experimentalDuotoneControl } from './duotone-control';
export { default as __experimentalFontAppearanceControl } from './font-appearance-control';
export { default as __experimentalFontFamilyControl } from './font-family';
export { default as __experimentalLetterSpacingControl } from './letter-spacing-control';
export { default as __experimentalTextColumnsControl } from './text-columns-control';
export { default as __experimentalTextDecorationControl } from './text-decoration-control';
export { default as __experimentalTextTransformControl } from './text-transform-control';
export { default as __experimentalColorGradientControl } from './colors-gradients/control';
Expand Down
101 changes: 0 additions & 101 deletions packages/block-editor/src/components/text-columns-control/index.js

This file was deleted.

This file was deleted.

15 changes: 12 additions & 3 deletions packages/block-editor/src/hooks/text-columns.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@
* WordPress dependencies
*/
import { hasBlockSupport } from '@wordpress/blocks';
import { RangeControl } from '@wordpress/components';
import { __ } from '@wordpress/i18n';

/**
* Internal dependencies
*/
import TextColumnsControl from '../components/text-columns-control';
import useSetting from '../components/use-setting';
import { cleanEmptyObject } from './utils';

Expand All @@ -16,6 +17,9 @@ import { cleanEmptyObject } from './utils';
*/
export const TEXT_COLUMNS_SUPPORT_KEY = 'typography.textColumns';

const MIN_COLUMNS = 1;
const MAX_COLUMNS = 5;

/**
* Inspector control containing the text columns option.
*
Expand All @@ -42,9 +46,14 @@ export function TextColumnsEdit( props ) {
}

return (
<TextColumnsControl
value={ style?.typography?.textColumns }
<RangeControl
label={ __( 'Text columns' ) }
max={ MAX_COLUMNS }
min={ MIN_COLUMNS }
onChange={ onChange }
size="__unstable-large"
value={ style?.typography?.textColumns }
initialPosition={ 1 }
/>
);
}
Expand Down
1 change: 0 additions & 1 deletion packages/block-editor/src/hooks/typography.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ export function TypographyPanel( props ) {
) }
{ ! isTextColumnsDisabled && (
<ToolsPanelItem
className="single-column"
hasValue={ () => hasTextColumnsValue( props ) }
label={ __( 'Text columns' ) }
onDeselect={ () => resetTextColumns( props ) }
Expand Down
37 changes: 22 additions & 15 deletions packages/edit-site/src/components/global-styles/typography-panel.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ import {
__experimentalLetterSpacingControl as LetterSpacingControl,
__experimentalTextTransformControl as TextTransformControl,
__experimentalTextDecorationControl as TextDecorationControl,
__experimentalTextColumnsControl as TextColumnsControl,
experiments as blockEditorExperiments,
} from '@wordpress/block-editor';
import {
FontSizePicker,
RangeControl,
__experimentalToolsPanel as ToolsPanel,
__experimentalToolsPanelItem as ToolsPanelItem,
} from '@wordpress/components';
Expand All @@ -26,6 +26,9 @@ import { unlock } from '../../experiments';

const { useGlobalSetting, useGlobalStyle } = unlock( blockEditorExperiments );

const MIN_COLUMNS = 1;
const MAX_COLUMNS = 5;

export function useHasTypographyPanel( name ) {
const hasFontFamily = useHasFontFamilyControl( name );
const hasLineHeight = useHasLineHeightControl( name );
Expand Down Expand Up @@ -388,20 +391,6 @@ export default function TypographyPanel( {
/>
</ToolsPanelItem>
) }
{ hasTextColumnsControl && (
<ToolsPanelItem
className="single-column"
label={ __( 'Text columns' ) }
hasValue={ hasTextColumns }
onDeselect={ resetTextColumns }
isShownByDefault
>
<TextColumnsControl
value={ textColumns }
onChange={ setTextColumns }
/>
</ToolsPanelItem>
) }
{ hasTextTransformControl && (
<ToolsPanelItem
label={ __( 'Letter case' ) }
Expand Down Expand Up @@ -435,6 +424,24 @@ export default function TypographyPanel( {
/>
</ToolsPanelItem>
) }
{ hasTextColumnsControl && (
<ToolsPanelItem
label={ __( 'Text columns' ) }
hasValue={ hasTextColumns }
onDeselect={ resetTextColumns }
isShownByDefault
>
<RangeControl
label={ __( 'Text columns' ) }
max={ MAX_COLUMNS }
min={ MIN_COLUMNS }
onChange={ setTextColumns }
size="__unstable-large"
value={ textColumns }
initialPosition={ 1 }
/>
</ToolsPanelItem>
) }
</ToolsPanel>
);
}

0 comments on commit 3dcaab9

Please sign in to comment.