Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block position controls: use V2 legacy adapter instead of V1 CustomSelectControl #63139

Merged
merged 1 commit into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 3 additions & 10 deletions packages/block-editor/src/hooks/position.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,25 +26,22 @@ import { cleanEmptyObject, useStyleOverride } from './utils';
import { unlock } from '../lock-unlock';
import { store as blockEditorStore } from '../store';

const { CustomSelectControl } = unlock( componentsPrivateApis );
const { CustomSelectControlV2Legacy: CustomSelectControl } = unlock(
componentsPrivateApis
);

const POSITION_SUPPORT_KEY = 'position';

const OPTION_CLASSNAME =
'block-editor-hooks__position-selection__select-control__option';

const DEFAULT_OPTION = {
key: 'default',
value: '',
name: __( 'Default' ),
className: OPTION_CLASSNAME,
};

const STICKY_OPTION = {
key: 'sticky',
value: 'sticky',
name: _x( 'Sticky', 'Name for the value of the CSS position property' ),
className: OPTION_CLASSNAME,
__experimentalHint: __(
'The block will stick to the top of the window instead of scrolling.'
),
Expand All @@ -54,7 +51,6 @@ const FIXED_OPTION = {
key: 'fixed',
value: 'fixed',
name: _x( 'Fixed', 'Name for the value of the CSS position property' ),
className: OPTION_CLASSNAME,
__experimentalHint: __(
'The block will not move when the page is scrolled.'
),
Expand Down Expand Up @@ -283,13 +279,11 @@ export function PositionPanelPure( {
options.length > 1 ? (
<InspectorControls group="position">
<BaseControl
className="block-editor-hooks__position-selection"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance someone was relying on these custom classes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I couldn't find direct usages in Gutenberg, and I also did a quick scan on WP Directory without finding any matches.

__nextHasNoMarginBottom
help={ stickyHelpText }
>
<CustomSelectControl
__next40pxDefaultSize
className="block-editor-hooks__position-selection__select-control"
label={ __( 'Position' ) }
hideLabelFromVision
describedBy={ sprintf(
Expand All @@ -299,7 +293,6 @@ export function PositionPanelPure( {
) }
options={ options }
value={ selectedOption }
__experimentalShowSelectedHint
onChange={ ( { selectedItem } ) => {
onChangeType( selectedItem.value );
} }
Expand Down
18 changes: 0 additions & 18 deletions packages/block-editor/src/hooks/position.scss

This file was deleted.

1 change: 0 additions & 1 deletion packages/block-editor/src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
@import "./hooks/color.scss";
@import "./hooks/dimensions.scss";
@import "./hooks/layout.scss";
@import "./hooks/position.scss";
@import "./hooks/spacing.scss";
@import "./hooks/typography.scss";

Expand Down
Loading