From 11111971ab3faa9e28cc99c77b72e837089574da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 21 Nov 2023 14:38:32 +0100 Subject: [PATCH 1/7] add deprecated version of all the __experimentalLinkControl components --- .../block-editor/src/components/link-control/index.js | 10 ++++++++++ .../src/components/link-control/search-input.js | 11 +++++++++++ .../src/components/link-control/search-item.js | 10 ++++++++++ .../src/components/link-control/search-results.js | 9 +++++++++ 4 files changed, 40 insertions(+) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index a208fa20d242ff..95a9d312bf1c3b 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -33,6 +33,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. @@ -499,4 +500,13 @@ function LinkControl( { LinkControl.ViewerFill = ViewerFill; LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; +export const DeprecatedExperimentalLinkControl = ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControl', { + since: '6.5', + alternative: 'wp.blockEditor.LinkControl', + } ); + + return ; +}; + export default LinkControl; diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js index d6023b9220d630..bc27b90cc25db0 100644 --- a/packages/block-editor/src/components/link-control/search-input.js +++ b/packages/block-editor/src/components/link-control/search-input.js @@ -16,6 +16,7 @@ import { URLInput } from '../'; import LinkControlSearchResults from './search-results'; import { CREATE_TYPE } from './constants'; import useSearchHandler from './use-search-handler'; +import deprecated from '@wordpress/deprecated'; // Must be a function as otherwise URLInput will default // to the fetchLinkSuggestions passed in block editor settings @@ -163,4 +164,14 @@ const LinkControlSearchInput = forwardRef( } ); +export const DeprecatedExperimentalLinkControlSearchInput = forwardRef( + ( props, ref ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', { + since: '6.5', + alternative: 'wp.blockEditor.LinkControlSearchInput', + } ); + return ; + } +); + export default LinkControlSearchInput; diff --git a/packages/block-editor/src/components/link-control/search-item.js b/packages/block-editor/src/components/link-control/search-item.js index 7fa8ee1803644c..60bfae1bc17535 100644 --- a/packages/block-editor/src/components/link-control/search-item.js +++ b/packages/block-editor/src/components/link-control/search-item.js @@ -17,6 +17,7 @@ import { import { __unstableStripHTML as stripHTML } from '@wordpress/dom'; import { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url'; import { pipe } from '@wordpress/compose'; +import deprecated from '@wordpress/deprecated'; const ICONS_MAP = { post: postList, @@ -153,4 +154,13 @@ function getVisualTypeName( suggestion ) { return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; } +export const DeprecatedExperimentalLinkControlSearchItem = ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchItem', { + since: '6.5', + alternative: 'wp.blockEditor.LinkControlSearchItem', + } ); + + return ; +}; + export default LinkControlSearchItem; diff --git a/packages/block-editor/src/components/link-control/search-results.js b/packages/block-editor/src/components/link-control/search-results.js index 4d5a388a32afb8..21f94b21ca903f 100644 --- a/packages/block-editor/src/components/link-control/search-results.js +++ b/packages/block-editor/src/components/link-control/search-results.js @@ -15,6 +15,7 @@ import classnames from 'classnames'; import LinkControlSearchCreate from './search-create-button'; import LinkControlSearchItem from './search-item'; import { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants'; +import deprecated from '@wordpress/deprecated'; export default function LinkControlSearchResults( { instanceId, @@ -132,3 +133,11 @@ export default function LinkControlSearchResults( { ); } + +export const DeprecatedExperimentalLinkControlSearchResults = ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchResults', { + since: '6.5', + alternative: 'wp.blockEditor.LinkControlSearchResults', + } ); + return ; +}; From 1d0a9d8aff3828aa86d98435390bea69c4265ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 21 Nov 2023 14:39:38 +0100 Subject: [PATCH 2/7] switch exports of LinkControl to stabilized version At the same the this retains the experimental versions of the exported component for better backwards compatibility for the wide usage of the LinkComponent already out there --- packages/block-editor/README.md | 20 +++++++++++++++++++ packages/block-editor/src/components/index.js | 20 +++++++++++++++---- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 2d6a5627a52a44..9cb59506be892f 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -651,6 +651,26 @@ _Related_ - +### 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. + +### LinkControlSearchInput + +Undocumented declaration. + +### LinkControlSearchItem + +Undocumented declaration. + +### LinkControlSearchResults + +Undocumented declaration. + ### MediaPlaceholder _Related_ diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index 08247d8cdb014a..44ae04adc26dd5 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -67,10 +67,22 @@ export { JustifyToolbar, JustifyContentControl, } from './justify-content-control'; -export { default 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'; +export { + default as LinkControl, + DeprecatedExperimentalLinkControl as __experimentalLinkControl, +} from './link-control'; +export { + default as LinkControlSearchInput, + DeprecatedExperimentalLinkControlSearchInput as __experimentalLinkControlSearchInput, +} from './link-control/search-input'; +export { + default as LinkControlSearchResults, + DeprecatedExperimentalLinkControlSearchResults as __experimentalLinkControlSearchResults, +} from './link-control/search-results'; +export { + default as LinkControlSearchItem, + DeprecatedExperimentalLinkControlSearchItem as __experimentalLinkControlSearchItem, +} from './link-control/search-item'; export { default as LineHeightControl } from './line-height-control'; export { default as __experimentalListView } from './list-view'; export { default as MediaReplaceFlow } from './media-replace-flow'; From 3c1b6a291bfe26b44871a583c6743b7d67925b98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 21 Nov 2023 14:40:08 +0100 Subject: [PATCH 3/7] update core blocks to use stabile version of LinkControl component --- packages/block-library/src/button/edit.js | 2 +- packages/block-library/src/navigation-link/link-ui.js | 2 +- packages/format-library/src/link/inline.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/block-library/src/button/edit.js b/packages/block-library/src/button/edit.js index 8400dabddad348..287c78ef3c5901 100644 --- a/packages/block-library/src/button/edit.js +++ b/packages/block-library/src/button/edit.js @@ -31,7 +31,7 @@ import { __experimentalUseBorderProps as useBorderProps, __experimentalUseColorProps as useColorProps, __experimentalGetSpacingClassesAndStyles as useSpacingProps, - __experimentalLinkControl as LinkControl, + LinkControl, __experimentalGetElementClassName, store as blockEditorStore, } from '@wordpress/block-editor'; diff --git a/packages/block-library/src/navigation-link/link-ui.js b/packages/block-library/src/navigation-link/link-ui.js index 3c3d91e7b0a052..5f9a99029330be 100644 --- a/packages/block-library/src/navigation-link/link-ui.js +++ b/packages/block-library/src/navigation-link/link-ui.js @@ -5,7 +5,7 @@ import { __unstableStripHTML as stripHTML } from '@wordpress/dom'; import { Popover, Button } from '@wordpress/components'; import { __, sprintf } from '@wordpress/i18n'; import { - __experimentalLinkControl as LinkControl, + LinkControl, BlockIcon, store as blockEditorStore, } from '@wordpress/block-editor'; diff --git a/packages/format-library/src/link/inline.js b/packages/format-library/src/link/inline.js index 58da13eb51ab6b..79b23d2619628b 100644 --- a/packages/format-library/src/link/inline.js +++ b/packages/format-library/src/link/inline.js @@ -19,7 +19,7 @@ import { concat, } from '@wordpress/rich-text'; import { - __experimentalLinkControl as LinkControl, + LinkControl, store as blockEditorStore, } from '@wordpress/block-editor'; import { useSelect } from '@wordpress/data'; From fbeb16e3e93b1118d72bdb68850d60d1450b0122 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 10 Dec 2024 09:14:43 +0100 Subject: [PATCH 4/7] fix update since param in deprecation of experimental export --- packages/block-editor/src/components/link-control/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/block-editor/src/components/link-control/index.js b/packages/block-editor/src/components/link-control/index.js index d3f24f824a7ff0..74ee2dbfd9a7f0 100644 --- a/packages/block-editor/src/components/link-control/index.js +++ b/packages/block-editor/src/components/link-control/index.js @@ -503,7 +503,7 @@ LinkControl.DEFAULT_LINK_SETTINGS = DEFAULT_LINK_SETTINGS; export const DeprecatedExperimentalLinkControl = ( props ) => { deprecated( 'wp.blockEditor.__experimentalLinkControl', { - since: '6.5', + since: '6.8', alternative: 'wp.blockEditor.LinkControl', } ); From 52ed606faa6ec04f3dd9c33df2ebea1c98dce595 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 10 Dec 2024 09:19:35 +0100 Subject: [PATCH 5/7] =?UTF-8?q?fix=20don=E2=80=99t=20deprecate=20internal?= =?UTF-8?q?=20link=20control=20components?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/block-editor/README.md | 12 ------------ packages/block-editor/src/components/index.js | 15 +++------------ .../src/components/link-control/search-input.js | 11 ----------- .../src/components/link-control/search-item.js | 10 ---------- .../src/components/link-control/search-results.js | 9 --------- 5 files changed, 3 insertions(+), 54 deletions(-) diff --git a/packages/block-editor/README.md b/packages/block-editor/README.md index 6654e0735ad8d7..13dffce114f59a 100644 --- a/packages/block-editor/README.md +++ b/packages/block-editor/README.md @@ -667,18 +667,6 @@ _Parameters_ - _props_ `WPLinkControlProps`: Component props. -### LinkControlSearchInput - -Undocumented declaration. - -### LinkControlSearchItem - -Undocumented declaration. - -### LinkControlSearchResults - -Undocumented declaration. - ### MediaPlaceholder _Related_ diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index 3b14eb68080b18..61e12e4843f9c0 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -71,18 +71,9 @@ export { default as LinkControl, DeprecatedExperimentalLinkControl as __experimentalLinkControl, } from './link-control'; -export { - default as LinkControlSearchInput, - DeprecatedExperimentalLinkControlSearchInput as __experimentalLinkControlSearchInput, -} from './link-control/search-input'; -export { - default as LinkControlSearchResults, - DeprecatedExperimentalLinkControlSearchResults as __experimentalLinkControlSearchResults, -} from './link-control/search-results'; -export { - default as LinkControlSearchItem, - DeprecatedExperimentalLinkControlSearchItem as __experimentalLinkControlSearchItem, -} from './link-control/search-item'; +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'; export { default as LineHeightControl } from './line-height-control'; export { default as __experimentalListView } from './list-view'; export { default as MediaReplaceFlow } from './media-replace-flow'; diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js index b9a0090709eb93..3f109b8a371552 100644 --- a/packages/block-editor/src/components/link-control/search-input.js +++ b/packages/block-editor/src/components/link-control/search-input.js @@ -11,7 +11,6 @@ import { URLInput } from '../'; import LinkControlSearchResults from './search-results'; import { CREATE_TYPE } from './constants'; import useSearchHandler from './use-search-handler'; -import deprecated from '@wordpress/deprecated'; // Must be a function as otherwise URLInput will default // to the fetchLinkSuggestions passed in block editor settings @@ -156,14 +155,4 @@ const LinkControlSearchInput = forwardRef( } ); -export const DeprecatedExperimentalLinkControlSearchInput = forwardRef( - ( props, ref ) => { - deprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', { - since: '6.5', - alternative: 'wp.blockEditor.LinkControlSearchInput', - } ); - return ; - } -); - export default LinkControlSearchInput; diff --git a/packages/block-editor/src/components/link-control/search-item.js b/packages/block-editor/src/components/link-control/search-item.js index 2c21e90e71c485..fa8d1540b3daed 100644 --- a/packages/block-editor/src/components/link-control/search-item.js +++ b/packages/block-editor/src/components/link-control/search-item.js @@ -17,7 +17,6 @@ import { import { __unstableStripHTML as stripHTML } from '@wordpress/dom'; import { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url'; import { pipe } from '@wordpress/compose'; -import deprecated from '@wordpress/deprecated'; const ICONS_MAP = { post: postList, @@ -160,13 +159,4 @@ function getVisualTypeName( suggestion ) { return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; } -export const DeprecatedExperimentalLinkControlSearchItem = ( props ) => { - deprecated( 'wp.blockEditor.__experimentalLinkControlSearchItem', { - since: '6.5', - alternative: 'wp.blockEditor.LinkControlSearchItem', - } ); - - return ; -}; - export default LinkControlSearchItem; diff --git a/packages/block-editor/src/components/link-control/search-results.js b/packages/block-editor/src/components/link-control/search-results.js index 55c621c66989db..29558f69291c57 100644 --- a/packages/block-editor/src/components/link-control/search-results.js +++ b/packages/block-editor/src/components/link-control/search-results.js @@ -15,7 +15,6 @@ import clsx from 'clsx'; import LinkControlSearchCreate from './search-create-button'; import LinkControlSearchItem from './search-item'; import { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants'; -import deprecated from '@wordpress/deprecated'; export default function LinkControlSearchResults( { withCreateSuggestion, @@ -122,11 +121,3 @@ export default function LinkControlSearchResults( { ); } - -export const DeprecatedExperimentalLinkControlSearchResults = ( props ) => { - deprecated( 'wp.blockEditor.__experimentalLinkControlSearchResults', { - since: '6.5', - alternative: 'wp.blockEditor.LinkControlSearchResults', - } ); - return ; -}; From ae6170af7c735af4c4dcbb097ed22029f94dfb7b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 10 Dec 2024 12:22:45 +0100 Subject: [PATCH 6/7] deprecate exports of LinkControl sub components --- .../src/components/link-control/search-input.js | 9 ++++++++- .../src/components/link-control/search-item.js | 9 ++++++++- .../src/components/link-control/search-results.js | 11 ++++++++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js index 3f109b8a371552..45ea2a53d7da1a 100644 --- a/packages/block-editor/src/components/link-control/search-input.js +++ b/packages/block-editor/src/components/link-control/search-input.js @@ -11,6 +11,7 @@ import { URLInput } from '../'; import LinkControlSearchResults from './search-results'; import { CREATE_TYPE } from './constants'; import useSearchHandler from './use-search-handler'; +import deprecated from '@wordpress/deprecated'; // Must be a function as otherwise URLInput will default // to the fetchLinkSuggestions passed in block editor settings @@ -155,4 +156,10 @@ const LinkControlSearchInput = forwardRef( } ); -export default LinkControlSearchInput; +export default ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', { + since: '6.8', + } ); + + return ; +}; diff --git a/packages/block-editor/src/components/link-control/search-item.js b/packages/block-editor/src/components/link-control/search-item.js index fa8d1540b3daed..22798f946797ff 100644 --- a/packages/block-editor/src/components/link-control/search-item.js +++ b/packages/block-editor/src/components/link-control/search-item.js @@ -17,6 +17,7 @@ import { import { __unstableStripHTML as stripHTML } from '@wordpress/dom'; import { safeDecodeURI, filterURLForDisplay, getPath } from '@wordpress/url'; import { pipe } from '@wordpress/compose'; +import deprecated from '@wordpress/deprecated'; const ICONS_MAP = { post: postList, @@ -159,4 +160,10 @@ function getVisualTypeName( suggestion ) { return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; } -export default LinkControlSearchItem; +export default ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchItem', { + since: '6.8', + } ); + + return ; +}; diff --git a/packages/block-editor/src/components/link-control/search-results.js b/packages/block-editor/src/components/link-control/search-results.js index 29558f69291c57..15f9225fc38ca4 100644 --- a/packages/block-editor/src/components/link-control/search-results.js +++ b/packages/block-editor/src/components/link-control/search-results.js @@ -15,8 +15,9 @@ import clsx from 'clsx'; import LinkControlSearchCreate from './search-create-button'; import LinkControlSearchItem from './search-item'; import { CREATE_TYPE, LINK_ENTRY_TYPES } from './constants'; +import deprecated from '@wordpress/deprecated'; -export default function LinkControlSearchResults( { +function LinkControlSearchResults( { withCreateSuggestion, currentInputValue, handleSuggestionClick, @@ -121,3 +122,11 @@ export default function LinkControlSearchResults( { ); } + +export default ( props ) => { + deprecated( 'wp.blockEditor.__experimentalLinkControlSearchResults', { + since: '6.8', + } ); + + return ; +}; From 526c0446016fdb506372b20b343003ff8a07c093 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Ka=CC=88gy?= Date: Tue, 10 Dec 2024 14:11:31 +0100 Subject: [PATCH 7/7] fix external exports of LinkControl internals --- packages/block-editor/src/components/index.js | 6 +++--- .../src/components/link-control/search-input.js | 4 +++- .../block-editor/src/components/link-control/search-item.js | 4 +++- .../src/components/link-control/search-results.js | 4 +++- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/packages/block-editor/src/components/index.js b/packages/block-editor/src/components/index.js index 61e12e4843f9c0..cf9167e4781576 100644 --- a/packages/block-editor/src/components/index.js +++ b/packages/block-editor/src/components/index.js @@ -71,9 +71,9 @@ 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'; +export { __experimentalLinkControlSearchInput } from './link-control/search-input'; +export { __experimentalLinkControlSearchResults } from './link-control/search-results'; +export { __experimentalLinkControlSearchItem } from './link-control/search-item'; export { default as LineHeightControl } from './line-height-control'; export { default as __experimentalListView } from './list-view'; export { default as MediaReplaceFlow } from './media-replace-flow'; diff --git a/packages/block-editor/src/components/link-control/search-input.js b/packages/block-editor/src/components/link-control/search-input.js index 45ea2a53d7da1a..2debdec296d948 100644 --- a/packages/block-editor/src/components/link-control/search-input.js +++ b/packages/block-editor/src/components/link-control/search-input.js @@ -156,7 +156,9 @@ const LinkControlSearchInput = forwardRef( } ); -export default ( props ) => { +export default LinkControlSearchInput; + +export const __experimentalLinkControlSearchInput = ( props ) => { deprecated( 'wp.blockEditor.__experimentalLinkControlSearchInput', { since: '6.8', } ); diff --git a/packages/block-editor/src/components/link-control/search-item.js b/packages/block-editor/src/components/link-control/search-item.js index 22798f946797ff..27084e5e77b96a 100644 --- a/packages/block-editor/src/components/link-control/search-item.js +++ b/packages/block-editor/src/components/link-control/search-item.js @@ -160,7 +160,9 @@ function getVisualTypeName( suggestion ) { return suggestion.type === 'post_tag' ? 'tag' : suggestion.type; } -export default ( props ) => { +export default LinkControlSearchItem; + +export const __experimentalLinkControlSearchItem = ( props ) => { deprecated( 'wp.blockEditor.__experimentalLinkControlSearchItem', { since: '6.8', } ); diff --git a/packages/block-editor/src/components/link-control/search-results.js b/packages/block-editor/src/components/link-control/search-results.js index 15f9225fc38ca4..6b405b0df1770c 100644 --- a/packages/block-editor/src/components/link-control/search-results.js +++ b/packages/block-editor/src/components/link-control/search-results.js @@ -123,7 +123,9 @@ function LinkControlSearchResults( { ); } -export default ( props ) => { +export default LinkControlSearchResults; + +export const __experimentalLinkControlSearchResults = ( props ) => { deprecated( 'wp.blockEditor.__experimentalLinkControlSearchResults', { since: '6.8', } );