Skip to content

Commit

Permalink
Add 'since' versions to the deprecated features (#30072)
Browse files Browse the repository at this point in the history
Deprecated features that aren't part of major WordPress releases have the plugin parameter set to Gutenberg.
  • Loading branch information
Mamaduka authored Mar 24, 2021
1 parent e7fd7fc commit 42dca26
Show file tree
Hide file tree
Showing 33 changed files with 56 additions and 9 deletions.
1 change: 1 addition & 0 deletions packages/block-editor/src/components/block-card/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import BlockIcon from '../block-icon';
function BlockCard( { title, icon, description, blockType } ) {
if ( blockType ) {
deprecated( '`blockType` property in `BlockCard component`', {
since: '5.7',
alternative: '`title, icon and description` properties',
} );
( { title, icon, description } = blockType );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { useBlockProps } from './use-block-props';
const BlockComponent = forwardRef(
( { children, tagName: TagName = 'div', ...props }, ref ) => {
deprecated( 'wp.blockEditor.__experimentalBlock', {
since: '5.6',
alternative: 'wp.blockEditor.useBlockProps',
} );
const blockProps = useBlockProps( { ...props, ref } );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,7 @@ export function MediaPlaceholder( {
if ( dropZoneUIOnly || disableMediaButtons ) {
if ( dropZoneUIOnly ) {
deprecated( 'wp.blockEditor.MediaPlaceholder dropZoneUIOnly prop', {
since: '5.4',
alternative: 'disableMediaButtons',
} );
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ function useIsAccessibleToolbar( ref ) {
const onlyToolbarItem = hasOnlyToolbarItem( tabbables );
if ( ! onlyToolbarItem ) {
deprecated( 'Using custom components as toolbar controls', {
since: '5.6',
alternative: 'ToolbarItem or ToolbarButton components',
link:
'https://developer.wordpress.org/block-editor/components/toolbar-button/#inside-blockcontrols',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import deprecated from '@wordpress/deprecated';

export default function PreserveScrollInReorder() {
deprecated( 'PreserveScrollInReorder component', {
since: '5.4',
hint: 'This behavior is now built-in the block list',
} );
return null;
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ function getAllowedFormats( {
}

deprecated( 'wp.blockEditor.RichText formattingControls prop', {
since: '5.4',
alternative: 'allowedFormats',
} );

Expand Down Expand Up @@ -716,6 +717,7 @@ function RichTextWrapper(
}

deprecated( 'wp.blockEditor.RichText wrapperClassName prop', {
since: '5.4',
alternative: 'className prop or create your own wrapper div',
} );

Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,8 @@ export function* insertBlocks(
meta = initialPosition;
initialPosition = 0;
deprecated( "meta argument in wp.data.dispatch('core/block-editor')", {
since: '10.1',
plugin: 'Gutenberg',
hint: 'The meta argument is now the 6th argument of the function',
} );
}
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/text-columns/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ export default function TextColumnsEdit( { attributes, setAttributes } ) {
const { width, content, columns } = attributes;

deprecated( 'The Text Columns block', {
since: '5.3',
alternative: 'the Columns block',
plugin: 'Gutenberg',
} );

return (
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/src/api/raw-handling/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export { pasteHandler } from './paste-handler';

export function deprecatedGetPhrasingContentSchema( context ) {
deprecated( 'wp.blocks.getPhrasingContentSchema', {
since: '5.6',
alternative: 'wp.dom.getPhrasingContentSchema',
} );
return getPhrasingContentSchema( context );
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 @@ -11,6 +11,7 @@ import Button from '../button';

function IconButton( { labelPosition, size, tooltip, label, ...props }, ref ) {
deprecated( 'wp.components.IconButton', {
since: '5.4',
alternative: 'wp.components.Button',
} );

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 @@ -51,6 +51,7 @@ export function Button( props, ref ) {

if ( isDefault ) {
deprecated( 'Button isDefault prop', {
since: '5.4',
alternative: 'isSecondary',
} );
}
Expand Down
2 changes: 2 additions & 0 deletions packages/components/src/clipboard-button/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ export default function ClipboardButton( {
...buttonProps
} ) {
deprecated( 'wp.components.ClipboardButton', {
since: '10.3',
plugin: 'Gutenberg',
alternative: 'wp.compose.useCopyToClipboard',
} );

Expand Down
4 changes: 2 additions & 2 deletions packages/components/src/dropdown-menu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ function DropdownMenu( {
} ) {
if ( menuLabel ) {
deprecated( '`menuLabel` prop in `DropdownComponent`', {
since: '5.3',
alternative: '`menuProps` object and its `aria-label` property',
plugin: 'Gutenberg',
} );
}

if ( position ) {
deprecated( '`position` prop in `DropdownComponent`', {
since: '5.3',
alternative: '`popoverProps` object and its `position` property',
plugin: 'Gutenberg',
} );
}

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/guide/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function Guide( {
useEffect( () => {
if ( Children.count( children ) ) {
deprecated( 'Passing children to <Guide>', {
since: '5.5',
alternative: 'the `pages` prop',
} );
}
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/guide/page.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import deprecated from '@wordpress/deprecated';
export default function GuidePage( props ) {
useEffect( () => {
deprecated( '<GuidePage>', {
since: '5.5',
alternative: 'the `pages` prop in <Guide>',
} );
}, [] );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export default createHigherOrderComponent( ( options ) => {

export const Provider = ( { children } ) => {
deprecated( 'wp.components.FocusReturnProvider component', {
since: '5.7',
hint:
'This provider is not used anymore. You can just remove it from your codebase',
} );
Expand Down
4 changes: 3 additions & 1 deletion packages/components/src/isolated-event-container/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ function stopPropagation( event ) {
}

export default forwardRef( ( { children, ...props }, ref ) => {
deprecated( 'wp.components.IsolatedEventContainer' );
deprecated( 'wp.components.IsolatedEventContainer', {
since: '5.7',
} );

// Disable reason: this stops certain events from propagating outside of the component.
// - onMouseDown is disabled as this can cause interactions with other DOM elements
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/modal/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ class Modal extends Component {

if ( isDismissable ) {
deprecated( 'isDismissable prop of the Modal component', {
since: '5.4',
alternative:
'isDismissible prop (renamed) of the Modal component',
} );
Expand Down
1 change: 1 addition & 0 deletions packages/components/src/popover/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ const Popover = ( {
} );

deprecated( 'Popover onClickOutside prop', {
since: '5.3',
alternative: 'onFocusOutside',
} );

Expand Down
1 change: 1 addition & 0 deletions packages/components/src/toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import ToolbarContainer from './toolbar-container';
function Toolbar( { className, label, ...props }, ref ) {
if ( ! label ) {
deprecated( 'Using Toolbar without label prop', {
since: '5.6',
alternative: 'ToolbarGroup component',
link:
'https://developer.wordpress.org/block-editor/components/toolbar/',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ const listener = new Listener();
*/
export default function withGlobalEvents( eventTypesToHandlers ) {
deprecated( 'wp.compose.withGlobalEvents', {
since: '5.7',
alternative: 'useEffect',
} );

Expand Down
2 changes: 2 additions & 0 deletions packages/compose/src/hooks/use-copy-on-click/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ import deprecated from '@wordpress/deprecated';
*/
export default function useCopyOnClick( ref, text, timeout = 4000 ) {
deprecated( 'wp.compose.useCopyOnClick', {
since: '10.3',
plugin: 'Gutenberg',
alternative: 'wp.compose.useCopyToClipboard',
} );

Expand Down
1 change: 1 addition & 0 deletions packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ export function* getEmbedPreview( url ) {
*/
export function* hasUploadPermissions() {
deprecated( "select( 'core' ).hasUploadPermissions()", {
since: '5.2',
alternative: "select( 'core' ).canUser( 'create', 'media' )",
} );
yield* canUser( 'create', 'media' );
Expand Down
1 change: 1 addition & 0 deletions packages/core-data/src/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -634,6 +634,7 @@ export function isPreviewEmbedFallback( state, url ) {
*/
export function hasUploadPermissions( state ) {
deprecated( "select( 'core' ).hasUploadPermissions()", {
since: '5.2',
alternative: "select( 'core' ).canUser( 'create', 'media' )",
} );
return defaultTo( canUser( state, 'create', 'media' ), true );
Expand Down
3 changes: 3 additions & 0 deletions packages/data-controls/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export function apiFetch( request ) {
*/
export function select( ...args ) {
deprecated( '`select` control in `@wordpress/data-controls`', {
since: '5.7',
alternative: 'built-in `resolveSelect` control in `@wordpress/data`',
} );

Expand All @@ -53,6 +54,7 @@ export function select( ...args ) {
*/
export function syncSelect( ...args ) {
deprecated( '`syncSelect` control in `@wordpress/data-controls`', {
since: '5.7',
alternative: 'built-in `select` control in `@wordpress/data`',
} );

Expand All @@ -67,6 +69,7 @@ export function syncSelect( ...args ) {
*/
export function dispatch( ...args ) {
deprecated( '`dispatch` control in `@wordpress/data-controls`', {
since: '5.7',
alternative: 'built-in `dispatch` control in `@wordpress/data`',
} );

Expand Down
1 change: 1 addition & 0 deletions packages/data/src/plugins/controls/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import deprecated from '@wordpress/deprecated';

export default ( registry ) => {
deprecated( 'wp.data.plugins.controls', {
since: '5.4',
hint: 'The controls plugins is now baked-in.',
} );
return registry;
Expand Down
2 changes: 2 additions & 0 deletions packages/editor/src/components/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ export { default as ServerSideRender } from '@wordpress/server-side-render';
function deprecateComponent( name, Wrapped, staticsToHoist = [] ) {
const Component = forwardRef( ( props, ref ) => {
deprecated( 'wp.editor.' + name, {
since: '5.3',
alternative: 'wp.blockEditor.' + name,
} );

Expand All @@ -84,6 +85,7 @@ function deprecateComponent( name, Wrapped, staticsToHoist = [] ) {
function deprecateFunction( name, func ) {
return ( ...args ) => {
deprecated( 'wp.editor.' + name, {
since: '5.3',
alternative: 'wp.blockEditor.' + name,
} );

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ export default VisualEditorGlobalKeyboardShortcuts;

export function EditorGlobalKeyboardShortcuts() {
deprecated( 'EditorGlobalKeyboardShortcuts', {
since: '5.2',
alternative: 'VisualEditorGlobalKeyboardShortcuts',
plugin: 'Gutenberg',
} );

return <VisualEditorGlobalKeyboardShortcuts />;
Expand Down
4 changes: 3 additions & 1 deletion packages/editor/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,8 @@ export function resetPost( post ) {
*/
export function* resetAutosave( newAutosave ) {
deprecated( 'resetAutosave action (`core/editor` store)', {
since: '5.3',
alternative: 'receiveAutosaves action (`core` store)',
plugin: 'Gutenberg',
} );

const postId = yield controls.select( STORE_NAME, 'getCurrentPostId' );
Expand Down Expand Up @@ -161,6 +161,7 @@ export function __experimentalRequestPostUpdateFinish( options = {} ) {
*/
export function updatePost() {
deprecated( "wp.data.dispatch( 'core/editor' ).updatePost", {
since: '5.7',
alternative: 'User the core entitires store instead',
} );
return {
Expand Down Expand Up @@ -649,6 +650,7 @@ export function updateEditorSettings( settings ) {
const getBlockEditorAction = ( name ) =>
function* ( ...args ) {
deprecated( "`wp.data.dispatch( 'core/editor' )." + name + '`', {
since: '5.3',
alternative:
"`wp.data.dispatch( 'core/block-editor' )." + name + '`',
} );
Expand Down
14 changes: 11 additions & 3 deletions packages/editor/src/store/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export const getReferenceByDistinctEdits = createRegistrySelector(
deprecated(
"`wp.data.select( 'core/editor' ).getReferenceByDistinctEdits`",
{
since: '5.4',
alternative:
"`wp.data.select( 'core' ).getReferenceByDistinctEdits`",
}
Expand Down Expand Up @@ -685,9 +686,9 @@ export const isEditedPostAutosaveable = createRegistrySelector(
*/
export const getAutosave = createRegistrySelector( ( select ) => ( state ) => {
deprecated( "`wp.data.select( 'core/editor' ).getAutosave()`", {
since: '5.3',
alternative:
"`wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
plugin: 'Gutenberg',
} );

const postType = getCurrentPostType( state );
Expand All @@ -713,9 +714,9 @@ export const getAutosave = createRegistrySelector( ( select ) => ( state ) => {
*/
export const hasAutosave = createRegistrySelector( ( select ) => ( state ) => {
deprecated( "`wp.data.select( 'core/editor' ).hasAutosave()`", {
since: '5.3',
alternative:
"`!! wp.data.select( 'core' ).getAutosave( postType, postId, userId )`",
plugin: 'Gutenberg',
} );

const postType = getCurrentPostType( state );
Expand Down Expand Up @@ -953,7 +954,7 @@ export function getSuggestedPostFormat( state ) {
*/
export function getBlocksForSerialization( state ) {
deprecated( '`core/editor` getBlocksForSerialization selector', {
plugin: 'Gutenberg',
since: '5.3',
alternative: 'getEditorBlocks',
hint: 'Blocks serialization pre-processing occurs at save time',
} );
Expand Down Expand Up @@ -1235,6 +1236,8 @@ export function getEditorBlocks( state ) {
*/
export function getEditorSelectionStart( state ) {
deprecated( "select('core/editor').getEditorSelectionStart", {
since: '10.0',
plugin: 'Gutenberg',
alternative: "select('core/editor').getEditorSelection",
} );
return getEditedPostAttribute( state, 'selection' )?.selectionStart;
Expand All @@ -1250,6 +1253,8 @@ export function getEditorSelectionStart( state ) {
*/
export function getEditorSelectionEnd( state ) {
deprecated( "select('core/editor').getEditorSelectionStart", {
since: '10.0',
plugin: 'Gutenberg',
alternative: "select('core/editor').getEditorSelection",
} );
return getEditedPostAttribute( state, 'selection' )?.selectionEnd;
Expand Down Expand Up @@ -1298,6 +1303,7 @@ export function getEditorSettings( state ) {
*/
export function getStateBeforeOptimisticTransaction() {
deprecated( "select('core/editor').getStateBeforeOptimisticTransaction", {
since: '5.7',
hint: 'No state history is kept on this store anymore',
} );

Expand All @@ -1311,6 +1317,7 @@ export function getStateBeforeOptimisticTransaction() {
*/
export function inSomeHistory() {
deprecated( "select('core/editor').inSomeHistory", {
since: '5.7',
hint: 'No state history is kept on this store anymore',
} );
return false;
Expand All @@ -1319,6 +1326,7 @@ export function inSomeHistory() {
function getBlockEditorSelector( name ) {
return createRegistrySelector( ( select ) => ( state, ...args ) => {
deprecated( "`wp.data.select( 'core/editor' )." + name + '`', {
since: '5.3',
alternative: "`wp.data.select( 'core/block-editor' )." + name + '`',
} );

Expand Down
2 changes: 2 additions & 0 deletions packages/interface/src/components/action-item/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ function ActionItemSlot( {
deprecated(
'Passing a tuple of components with `as` prop to `ActionItem.Slot` component',
{
since: '10.2',
plugin: 'Gutenberg',
alternative: 'a component with `as` prop',
version: '10.3',
}
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 @@ -7,5 +7,6 @@ export { store } from './store';
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.',
} );
Loading

0 comments on commit 42dca26

Please sign in to comment.