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

Remove APIs deprecated on WordPress 5.4 #38564

Merged
merged 2 commits into from
Feb 7, 2022
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
23 changes: 0 additions & 23 deletions docs/reference-guides/data/data-core-editor.md
Original file line number Diff line number Diff line change
Expand Up @@ -516,29 +516,6 @@ _Related_

- getPreviousBlockClientId in core/block-editor store.

### getReferenceByDistinctEdits

> **Deprecated** since Gutenberg 6.5.0.

Returns a new reference when edited values have changed. This is useful in
inferring where an edit has been made between states by comparison of the
return values using strict equality.

_Usage_

const hasEditOccurred = (
getReferenceByDistinctEdits( beforeState ) !==
getReferenceByDistinctEdits( afterState )
);

_Parameters_

- _state_ `Object`: Editor state.

_Returns_

- `*`: A value whose reference will change only when an edit occurs.

### getSelectedBlock

_Related_
Expand Down
4 changes: 0 additions & 4 deletions packages/block-editor/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -524,10 +524,6 @@ _Related_

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

### PreserveScrollInReorder

Undocumented declaration.

### RichText

_Related_
Expand Down
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 @@ -134,7 +134,6 @@ export {
useTypingObserver as __unstableUseTypingObserver,
useMouseMoveTypingReset as __unstableUseMouseMoveTypingReset,
} from './observe-typing';
export { default as PreserveScrollInReorder } from './preserve-scroll-in-reorder';
export { default as SkipToSelectedBlock } from './skip-to-selected-block';
export {
default as Typewriter,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ import {
import { __ } from '@wordpress/i18n';
import { useState, useEffect } from '@wordpress/element';
import { useSelect } from '@wordpress/data';
import deprecated from '@wordpress/deprecated';
import { keyboardReturn } from '@wordpress/icons';

/**
Expand Down Expand Up @@ -65,7 +64,6 @@ export function MediaPlaceholder( {
addToGallery,
multiple = false,
handleUpload = true,
dropZoneUIOnly,
disableDropZone,
disableMediaButtons,
onError,
Expand Down Expand Up @@ -400,14 +398,7 @@ export function MediaPlaceholder( {
return renderPlaceholder( uploadMediaLibraryButton );
};

if ( dropZoneUIOnly || disableMediaButtons ) {
if ( dropZoneUIOnly ) {
deprecated( 'wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop', {
since: '5.4',
alternative: 'disableMediaButtons',
} );
}

if ( disableMediaButtons ) {
return <MediaUploadCheck>{ renderDropZone() }</MediaUploadCheck>;
}

Expand Down

This file was deleted.

1 change: 1 addition & 0 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -400,6 +400,7 @@ function RichTextWrapper(
deprecated( 'wp.blockEditor.RichText wrapperClassName prop', {
since: '5.4',
alternative: 'className prop or create your own wrapper div',
version: '6.2',
} );

const className = classnames( 'block-editor-rich-text', wrapperClassName );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,7 @@ function RichTextWrapper(
deprecated( 'wp.blockEditor.RichText wrapperClassName prop', {
since: '5.4',
alternative: 'className prop or create your own wrapper div',
version: '6.2',
} );

return (
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/rich-text/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export function getAllowedFormats( {
deprecated( 'wp.blockEditor.RichText formattingControls prop', {
since: '5.4',
alternative: 'allowedFormats',
version: '6.2',
} );

return formattingControls.map( ( name ) => `core/${ name }` );
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/button/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ function IconButton( { labelPosition, size, tooltip, label, ...props }, ref ) {
deprecated( 'wp.components.IconButton', {
since: '5.4',
alternative: 'wp.components.Button',
version: '6.2',
} );

return (
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ function useDeprecatedProps( {
deprecated( 'Button isDefault prop', {
since: '5.4',
alternative: 'variant="secondary"',
version: '6.2',
} );

computedVariant ??= 'secondary';
Expand Down
11 changes: 1 addition & 10 deletions packages/components/src/modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
useConstrainedTabbing,
useMergeRefs,
} from '@wordpress/compose';
import deprecated from '@wordpress/deprecated';
import { ESCAPE } from '@wordpress/keycodes';
import { __ } from '@wordpress/i18n';
import { closeSmall } from '@wordpress/icons';
Expand All @@ -45,8 +44,7 @@ function Modal( props, forwardedRef ) {
focusOnMount = true,
shouldCloseOnEsc = true,
shouldCloseOnClickOutside = true,
isDismissable, // Deprecated
isDismissible = isDismissable || true,
isDismissible = true,
/* accessibility */
aria = {
labelledby: null,
Expand Down Expand Up @@ -93,13 +91,6 @@ function Modal( props, forwardedRef ) {
};
}, [] );

if ( isDismissable ) {
deprecated( 'isDismissable prop of the Modal component', {
since: '5.4',
alternative: 'isDismissible prop (renamed) of the Modal component',
} );
}

function handleEscapeKeyDown( event ) {
if (
shouldCloseOnEsc &&
Expand Down
12 changes: 0 additions & 12 deletions packages/data/src/plugins/controls/index.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/data/src/plugins/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
export { default as controls } from './controls';
export { default as persistence } from './persistence';
4 changes: 4 additions & 0 deletions packages/data/src/registry.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,10 @@ export function createRegistry( storeConfigs = {}, parent = null ) {
// This function will be deprecated as soon as it is no longer internally referenced.
//
function use( plugin, options ) {
if ( ! plugin ) {
return;
}
Comment on lines +294 to +296
Copy link
Member

Choose a reason for hiding this comment

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

I assume this is a fix for wp.data.plugins.control.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yep


registry = {
...registry,
...plugin( registry, options ),
Expand Down
5 changes: 0 additions & 5 deletions packages/editor/src/components/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
MultiSelectScrollIntoView as RootMultiSelectScrollIntoView,
NavigableToolbar as RootNavigableToolbar,
ObserveTyping as RootObserveTyping,
PreserveScrollInReorder as RootPreserveScrollInReorder,
SkipToSelectedBlock as RootSkipToSelectedBlock,
URLInput as RootURLInput,
URLInputButton as RootURLInputButton,
Expand Down Expand Up @@ -224,10 +223,6 @@ export const ObserveTyping = deprecateComponent(
'ObserveTyping',
RootObserveTyping
);
export const PreserveScrollInReorder = deprecateComponent(
'PreserveScrollInReorder',
RootPreserveScrollInReorder
);
export const SkipToSelectedBlock = deprecateComponent(
'SkipToSelectedBlock',
RootSkipToSelectedBlock
Expand Down
35 changes: 0 additions & 35 deletions packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -277,41 +277,6 @@ export const getPostEdits = createRegistrySelector( ( select ) => ( state ) => {
);
} );

/**
* Returns a new reference when edited values have changed. This is useful in
* inferring where an edit has been made between states by comparison of the
* return values using strict equality.
*
* @deprecated since Gutenberg 6.5.0.
*
* @example
*
* ```
* const hasEditOccurred = (
* getReferenceByDistinctEdits( beforeState ) !==
* getReferenceByDistinctEdits( afterState )
* );
* ```
*
* @param {Object} state Editor state.
*
* @return {*} A value whose reference will change only when an edit occurs.
*/
export const getReferenceByDistinctEdits = createRegistrySelector(
( select ) => (/* state */) => {
deprecated(
"`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`",
{
since: '5.4',
alternative:
"`wp.data.select( 'core' ).getReferenceByDistinctEdits`",
}
);

return select( coreStore ).getReferenceByDistinctEdits();
}
);

/**
* Returns an attribute value of the saved post.
*
Expand Down
1 change: 1 addition & 0 deletions packages/nux/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ export { default as DotTip } from './components/dot-tip';
deprecated( 'wp.nux', {
since: '5.4',
hint: 'wp.components.Guide can be used to show a user guide.',
version: '6.2',
} );