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

Stabilize LinkControl Component #56384

Merged
merged 9 commits into from
Dec 10, 2024
8 changes: 8 additions & 0 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,14 @@ _Related_

- <https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/line-height-control/README.md>

### LinkControl

Renders a link control. A link control is a controlled input which maintains a value associated with a link (HTML anchor element) and relevant settings for how that link is expected to behave.

_Parameters_

- _props_ `WPLinkControlProps`: Component props.
fabiankaegy marked this conversation as resolved.
Show resolved Hide resolved

### MediaPlaceholder

_Related_
Expand Down
5 changes: 4 additions & 1 deletion packages/block-editor/src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@ export {
JustifyToolbar,
JustifyContentControl,
} from './justify-content-control';
export { default as __experimentalLinkControl } from './link-control';
export {
default as LinkControl,
DeprecatedExperimentalLinkControl as __experimentalLinkControl,
} from './link-control';
export { default as __experimentalLinkControlSearchInput } from './link-control/search-input';
export { default as __experimentalLinkControlSearchResults } from './link-control/search-results';
export { default as __experimentalLinkControlSearchItem } from './link-control/search-item';
Expand Down
10 changes: 10 additions & 0 deletions packages/block-editor/src/components/link-control/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import useCreatePage from './use-create-page';
import useInternalValue from './use-internal-value';
import { ViewerFill } from './viewer-slot';
import { DEFAULT_LINK_SETTINGS } from './constants';
import deprecated from '@wordpress/deprecated';

/**
* Default properties associated with a link control value.
Expand Down Expand Up @@ -500,4 +501,13 @@ function LinkControl( {
LinkControl.ViewerFill = ViewerFill;
LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS;

export const DeprecatedExperimentalLinkControl = ( props ) => {
deprecated( 'wp.blockEditor.__experimentalLinkControl', {
since: '6.8',
alternative: 'wp.blockEditor.LinkControl',
} );

return <LinkControl { ...props } />;
};

export default LinkControl;
2 changes: 1 addition & 1 deletion packages/block-library/src/button/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ import {
InspectorControls,
RichText,
useBlockProps,
LinkControl,
__experimentalUseBorderProps as useBorderProps,
__experimentalUseColorProps as useColorProps,
__experimentalGetSpacingClassesAndStyles as useSpacingProps,
__experimentalGetShadowClassesAndStyles as useShadowProps,
__experimentalLinkControl as LinkControl,
__experimentalGetElementClassName,
store as blockEditorStore,
useBlockEditingMode,
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/navigation-link/link-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@wordpress/components';
import { __, sprintf, isRTL } from '@wordpress/i18n';
import {
__experimentalLinkControl as LinkControl,
LinkControl,
store as blockEditorStore,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
Expand Down
2 changes: 1 addition & 1 deletion packages/format-library/src/link/inline.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
useAnchor,
} from '@wordpress/rich-text';
import {
__experimentalLinkControl as LinkControl,
LinkControl,
store as blockEditorStore,
} from '@wordpress/block-editor';
import { useDispatch, useSelect } from '@wordpress/data';
Expand Down
Loading