From e95026cee0d66b98d8b4e958cfacf8fe9a9e8b2d Mon Sep 17 00:00:00 2001
From: Andrew Duthie
Date: Wed, 8 Aug 2018 04:19:53 -0400
Subject: [PATCH] Framework: Remove deprecations slated for 3.5 removal (#8687)
* Framework: Update use of deprecated UID
* Framework: Update use of deprecated compose
* Framework: Remove deprecations slated for v3.5 removal
* Framework: Update package dependencies after deprecation removals
---
core-blocks/test/full-content.js | 2 -
.../plugin-block-settings-menu-group.js | 2 +-
.../plugin-block-settings-menu-item.js | 2 +-
lib/client-assets.php | 4 +-
package-lock.json | 32 ++---
packages/blocks/src/api/factory.js | 4 -
packages/blocks/src/api/test/factory.js | 4 +-
packages/components/src/deprecated.js | 35 -----
packages/components/src/index.js | 11 --
.../compose/src/with-instance-id/README.md | 2 +-
.../compose/src/with-safe-timeout/README.md | 2 +-
packages/editor/package.json | 1 -
.../editor/src/components/block-edit/index.js | 3 +-
.../editor/src/components/block-list/index.js | 70 +---------
.../src/components/block-list/layout.js | 2 -
.../src/components/block-mover/index.js | 2 -
.../components/block-settings-menu/index.js | 15 +--
.../src/components/block-title/index.js | 23 +---
.../default-block-appender/index.js | 2 -
packages/editor/src/components/index.js | 2 +-
.../src/components/media-placeholder/index.js | 26 +---
.../editor/src/components/rich-text/format.js | 60 ---------
.../editor/src/components/rich-text/index.js | 13 --
.../test/__snapshots__/format.js.snap | 22 ----
.../src/components/rich-text/test/format.js | 73 -----------
.../editor/src/components/url-input/index.js | 26 +---
.../with-deprecated-unique-id/index.js | 60 ---------
packages/editor/src/store/selectors.js | 124 +-----------------
packages/editor/src/store/test/selectors.js | 10 --
packages/element/package.json | 2 -
packages/element/src/deprecated.js | 60 ---------
packages/element/src/index.js | 3 -
test/e2e/specs/reusable-blocks.test.js | 4 +-
test/integration/shortcode-converter.spec.js | 14 --
utils/deprecated.js | 48 -------
utils/index.js | 1 -
36 files changed, 53 insertions(+), 713 deletions(-)
delete mode 100644 packages/components/src/deprecated.js
delete mode 100644 packages/editor/src/components/with-deprecated-unique-id/index.js
delete mode 100644 packages/element/src/deprecated.js
delete mode 100644 utils/deprecated.js
diff --git a/core-blocks/test/full-content.js b/core-blocks/test/full-content.js
index 78f04d0fae3d32..a76b37ad885275 100644
--- a/core-blocks/test/full-content.js
+++ b/core-blocks/test/full-content.js
@@ -87,8 +87,6 @@ function normalizeParsedBlocks( blocks ) {
// Change client IDs to a predictable value
block.clientId = '_clientId_' + index;
- // TODO: Remove in 3.5 "UID" deprecation.
- delete block.uid;
// Walk each attribute and get a more concise representation of any
// React elements
diff --git a/edit-post/components/block-settings-menu/plugin-block-settings-menu-group.js b/edit-post/components/block-settings-menu/plugin-block-settings-menu-group.js
index 2018035e92ff6b..24859cb92fcc3c 100644
--- a/edit-post/components/block-settings-menu/plugin-block-settings-menu-group.js
+++ b/edit-post/components/block-settings-menu/plugin-block-settings-menu-group.js
@@ -27,7 +27,7 @@ const PluginBlockSettingsMenuGroupSlot = ( { fillProps, selectedBlocks } ) => {
};
PluginBlockSettingsMenuGroup.Slot = withSelect( ( select, { fillProps: { clientIds } } ) => ( {
- selectedBlocks: select( 'core/editor' ).getBlocksByUID( clientIds ),
+ selectedBlocks: select( 'core/editor' ).getBlocksByClientId( clientIds ),
} ) )( PluginBlockSettingsMenuGroupSlot );
export default PluginBlockSettingsMenuGroup;
diff --git a/edit-post/components/block-settings-menu/plugin-block-settings-menu-item.js b/edit-post/components/block-settings-menu/plugin-block-settings-menu-item.js
index 9fd8b376c1478c..50bd460a11624c 100644
--- a/edit-post/components/block-settings-menu/plugin-block-settings-menu-item.js
+++ b/edit-post/components/block-settings-menu/plugin-block-settings-menu-item.js
@@ -7,7 +7,7 @@ import { difference } from 'lodash';
* WordPress dependencies
*/
import { IconButton } from '@wordpress/components';
-import { compose } from '@wordpress/element';
+import { compose } from '@wordpress/compose';
/**
* Internal dependencies
diff --git a/lib/client-assets.php b/lib/client-assets.php
index bcf6027e3877a1..3d9d1ca963c273 100644
--- a/lib/client-assets.php
+++ b/lib/client-assets.php
@@ -266,7 +266,7 @@ function gutenberg_register_scripts_and_styles() {
wp_register_script(
'wp-utils',
gutenberg_url( 'build/utils/index.js' ),
- array( 'lodash', 'wp-api-fetch', 'wp-deprecated', 'wp-html-entities', 'wp-i18n', 'wp-editor' ),
+ array( 'lodash', 'wp-api-fetch', 'wp-data', 'wp-deprecated', 'wp-i18n', 'wp-editor' ),
filemtime( gutenberg_dir_path() . 'build/utils/index.js' ),
true
);
@@ -322,7 +322,7 @@ function gutenberg_register_scripts_and_styles() {
wp_register_script(
'wp-element',
gutenberg_url( 'build/element/index.js' ),
- array( 'react', 'react-dom', 'wp-is-shallow-equal', 'lodash', 'wp-deprecated' ),
+ array( 'react', 'react-dom', 'lodash' ),
filemtime( gutenberg_dir_path() . 'build/element/index.js' ),
true
);
diff --git a/package-lock.json b/package-lock.json
index 0e84731c3789d6..2c907e27b958c6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -2406,7 +2406,6 @@
"@wordpress/viewport": "file:packages/viewport",
"@wordpress/wordcount": "file:packages/wordcount",
"classnames": "^2.2.5",
- "dom-react": "^2.2.1",
"dom-scroll-into-view": "^1.2.1",
"element-closest": "^2.0.2",
"lodash": "^4.17.10",
@@ -2425,8 +2424,6 @@
"version": "file:packages/element",
"requires": {
"@babel/runtime-corejs2": "7.0.0-beta.56",
- "@wordpress/deprecated": "file:packages/deprecated",
- "@wordpress/is-shallow-equal": "file:packages/is-shallow-equal",
"lodash": "^4.17.10",
"react": "^16.4.1",
"react-dom": "^16.4.1"
@@ -6632,11 +6629,6 @@
"esutils": "^2.0.2"
}
},
- "dom-react": {
- "version": "2.2.1",
- "resolved": "https://registry.npmjs.org/dom-react/-/dom-react-2.2.1.tgz",
- "integrity": "sha512-kqvoG+Q5oiJMQzQi245ZVA/X2Py2lBCebGcQzQeR51jOJqVghWBodKoJcitX8VRV+e6ku+9hRS+Bev/zmlSPsg=="
- },
"dom-scroll-into-view": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/dom-scroll-into-view/-/dom-scroll-into-view-1.2.1.tgz",
@@ -10652,6 +10644,16 @@
"source-map": "^0.5.7"
}
},
+ "babel-jest": {
+ "version": "23.4.2",
+ "resolved": "https://registry.npmjs.org/babel-jest/-/babel-jest-23.4.2.tgz",
+ "integrity": "sha512-wg1LJ2tzsafXqPFVgAsYsMCVD5U7kwJZAvbZIxVm27iOewsQw1BR7VZifDlMTEWVo3wasoPPyMdKXWCsfFPr3Q==",
+ "dev": true,
+ "requires": {
+ "babel-plugin-istanbul": "^4.1.6",
+ "babel-preset-jest": "^23.2.0"
+ }
+ },
"braces": {
"version": "1.8.5",
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz",
@@ -12320,9 +12322,9 @@
"dev": true
},
"kleur": {
- "version": "1.0.1",
- "resolved": "https://registry.npmjs.org/kleur/-/kleur-1.0.1.tgz",
- "integrity": "sha512-8srIZ5BK5PCJw1L/JN741xgNfSjuQNK9ImYbYzv7ZUD3WPfuywaY+yd7lQOphJ+2vwXnMLnRZoAh5X+orRt4LQ==",
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/kleur/-/kleur-2.0.1.tgz",
+ "integrity": "sha512-Zq/jyANIJ2uX8UZjWlqLwbyhcxSXJtT/Y89lClyeZd3l++3ztL1I5SSCYrbcbwSunTjC88N3WuMk0kRDQD6gzA==",
"dev": true
},
"known-css-properties": {
@@ -16075,12 +16077,12 @@
"dev": true
},
"prompts": {
- "version": "0.1.12",
- "resolved": "https://registry.npmjs.org/prompts/-/prompts-0.1.12.tgz",
- "integrity": "sha512-pgR1GE1JM8q8UsHVIgjdK62DPwvrf0kvaKWJ/mfMoCm2lwfIReX/giQ1p0AlMoUXNhQap/8UiOdqi3bOROm/eg==",
+ "version": "0.1.14",
+ "resolved": "https://registry.npmjs.org/prompts/-/prompts-0.1.14.tgz",
+ "integrity": "sha512-rxkyiE9YH6zAz/rZpywySLKkpaj0NMVyNw1qhsubdbjjSgcayjTShDreZGlFMcGSu5sab3bAKPfFk78PB90+8w==",
"dev": true,
"requires": {
- "kleur": "^1.0.0",
+ "kleur": "^2.0.1",
"sisteransi": "^0.1.1"
}
},
diff --git a/packages/blocks/src/api/factory.js b/packages/blocks/src/api/factory.js
index ef9de61959bd58..b7c7474f7dbc39 100644
--- a/packages/blocks/src/api/factory.js
+++ b/packages/blocks/src/api/factory.js
@@ -58,8 +58,6 @@ export function createBlock( name, blockAttributes = {}, innerBlocks = [] ) {
// attributes, and their inner blocks.
return {
clientId,
- // TODO: Remove from block interface in 3.5 "UID" deprecation.
- uid: clientId,
name,
isValid: true,
attributes,
@@ -83,8 +81,6 @@ export function cloneBlock( block, mergeAttributes = {}, newInnerBlocks ) {
return {
...block,
clientId,
- // TODO: Remove from block interface in 3.5 "UID" deprecation.
- uid: uuid(),
attributes: {
...block.attributes,
...mergeAttributes,
diff --git a/packages/blocks/src/api/test/factory.js b/packages/blocks/src/api/test/factory.js
index 12363de75f0723..c8fae328094527 100644
--- a/packages/blocks/src/api/test/factory.js
+++ b/packages/blocks/src/api/test/factory.js
@@ -1024,9 +1024,9 @@ describe( 'block factory', () => {
const transformedBlocks = switchToBlockType( block, 'core/updated-text-block' );
- // Make sure the block UIDs are set as expected: the first
+ // Make sure the block client IDs are set as expected: the first
// transformed block whose type matches the "destination" type gets
- // to keep the existing block's UID.
+ // to keep the existing block's client ID.
expect( transformedBlocks ).toHaveLength( 2 );
expect( transformedBlocks[ 0 ] ).toHaveProperty( 'clientId' );
expect( transformedBlocks[ 0 ].clientId ).not.toBe( block.clientId );
diff --git a/packages/components/src/deprecated.js b/packages/components/src/deprecated.js
deleted file mode 100644
index 1f7714435ea6af..00000000000000
--- a/packages/components/src/deprecated.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * External dependencies
- */
-import { mapValues } from 'lodash';
-
-/**
- * WordPress dependencies
- */
-import {
- ifCondition,
- withGlobalEvents,
- withInstanceId,
- withSafeTimeout,
- withState,
-} from '@wordpress/compose';
-import deprecated from '@wordpress/deprecated';
-
-const deprecatedFunctions = {
- ifCondition,
- withGlobalEvents,
- withInstanceId,
- withSafeTimeout,
- withState,
-};
-
-export default mapValues( deprecatedFunctions, ( deprecatedFunction, key ) => {
- return ( ...args ) => {
- deprecated( 'wp.components.' + key, {
- version: '3.5',
- alternative: 'wp.compose.' + key,
- } );
-
- return deprecatedFunction( ...args );
- };
-} );
diff --git a/packages/components/src/index.js b/packages/components/src/index.js
index ed5ccd81136fb1..182cb6e111c0d3 100644
--- a/packages/components/src/index.js
+++ b/packages/components/src/index.js
@@ -1,8 +1,3 @@
-/**
- * Internal dependencies
- */
-import deprecated from './deprecated';
-
// Components
// eslint-disable-next-line camelcase
export { default as APIProvider, unstable__setApiSettings } from './higher-order/with-api-data/provider';
@@ -73,9 +68,3 @@ export { default as withFocusOutside } from './higher-order/with-focus-outside';
export { default as withFocusReturn } from './higher-order/with-focus-return';
export { default as withNotices } from './higher-order/with-notices';
export { default as withSpokenMessages } from './higher-order/with-spoken-messages';
-
-export const ifCondition = deprecated.ifCondition;
-export const withGlobalEvents = deprecated.withGlobalEvents;
-export const withInstanceId = deprecated.withInstanceId;
-export const withSafeTimeout = deprecated.withSafeTimeout;
-export const withState = deprecated.withState;
diff --git a/packages/compose/src/with-instance-id/README.md b/packages/compose/src/with-instance-id/README.md
index 31dd5c3e845f26..c4cca426b107b1 100644
--- a/packages/compose/src/with-instance-id/README.md
+++ b/packages/compose/src/with-instance-id/README.md
@@ -10,7 +10,7 @@ Wrapping a component with `withInstanceId` provides a unique `instanceId` to ser
/**
* WordPress dependencies
*/
-import { withInstanceId } from '@wordpress/components';
+import { withInstanceId } from '@wordpress/compose';
function MyCustomElement( { instanceId } ) {
return (
diff --git a/packages/compose/src/with-safe-timeout/README.md b/packages/compose/src/with-safe-timeout/README.md
index 097e652b055b61..b397f7f173f8e4 100644
--- a/packages/compose/src/with-safe-timeout/README.md
+++ b/packages/compose/src/with-safe-timeout/README.md
@@ -9,7 +9,7 @@ withSafeTimeout
/**
* WordPress dependencies
*/
-import { withSafeTimeout } from '@wordpress/components';
+import { withSafeTimeout } from '@wordpress/compose';
function MyEffectfulComponent( { setTimeout } ) {
return (
diff --git a/packages/editor/package.json b/packages/editor/package.json
index 88cc8e12d4cd4b..d3d94984ce4d8a 100644
--- a/packages/editor/package.json
+++ b/packages/editor/package.json
@@ -43,7 +43,6 @@
"@wordpress/viewport": "file:../viewport",
"@wordpress/wordcount": "file:../wordcount",
"classnames": "^2.2.5",
- "dom-react": "^2.2.1",
"dom-scroll-into-view": "^1.2.1",
"element-closest": "^2.0.2",
"lodash": "^4.17.10",
diff --git a/packages/editor/src/components/block-edit/index.js b/packages/editor/src/components/block-edit/index.js
index d42f151da1a890..c4c78f906aef91 100644
--- a/packages/editor/src/components/block-edit/index.js
+++ b/packages/editor/src/components/block-edit/index.js
@@ -8,7 +8,6 @@ import { Component } from '@wordpress/element';
*/
import Edit from './edit';
import { BlockEditContextProvider } from './context';
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
class BlockEdit extends Component {
constructor( props ) {
@@ -50,4 +49,4 @@ class BlockEdit extends Component {
}
}
-export default withDeprecatedUniqueId( BlockEdit );
+export default BlockEdit;
diff --git a/packages/editor/src/components/block-list/index.js b/packages/editor/src/components/block-list/index.js
index 53f268ba871e1e..ed5c131cae9b2e 100644
--- a/packages/editor/src/components/block-list/index.js
+++ b/packages/editor/src/components/block-list/index.js
@@ -1,74 +1,18 @@
-/**
- * External dependencies
- */
-import {
- reduce,
- get,
- map,
-} from 'lodash';
-
/**
* WordPress dependencies
*/
-import { createElement } from '@wordpress/element';
import { withSelect } from '@wordpress/data';
-import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
*/
import BlockListLayout from './layout';
-const UngroupedLayoutBlockList = withSelect(
- ( select, ownProps ) => ( {
- blockClientIds: select( 'core/editor' ).getBlockOrder( ownProps.rootClientId ),
- } )
-)( BlockListLayout );
-
-const GroupedLayoutBlockList = withSelect(
- ( select, ownProps ) => ( {
- blocks: select( 'core/editor' ).getBlocks( ownProps.rootClientId ),
- } ),
-)( ( {
- blocks,
- layouts,
- ...props
-} ) => map( layouts, ( layout ) => {
- deprecated( 'grouped layout', {
- alternative: 'intermediary nested inner blocks',
- version: '3.5',
- plugin: 'Gutenberg',
- hint: 'See core Columns / Column block for reference implementation',
- } );
-
- // Filter blocks assigned to layout when rendering grouped layouts.
- const layoutBlockClientIds = reduce( blocks, ( result, block ) => {
- if ( get( block, [ 'attributes', 'layout' ] ) === layout.name ) {
- result.push( block.clientId );
- }
-
- return result;
- }, [] );
-
- return (
-
- );
-} ) );
-
-const BlockList = ( props ) => createElement(
- // BlockList can be provided with a layouts configuration, either grouped
- // (blocks adjacent in markup) or ungrouped. This is inferred by the shape
- // of the layouts configuration passed (grouped layout as array).
- Array.isArray( props.layouts ) ?
- GroupedLayoutBlockList :
- UngroupedLayoutBlockList,
- props
-);
+// TODO: This should be refactored to flatten BlockListLayout into this file.
+export default withSelect( ( select, ownProps ) => {
+ const { getBlockOrder } = select( 'core/editor' );
-export default BlockList;
+ return {
+ blockClientIds: getBlockOrder( ownProps.rootClientId ),
+ };
+} )( BlockListLayout );
diff --git a/packages/editor/src/components/block-list/layout.js b/packages/editor/src/components/block-list/layout.js
index e82b3c6f2602e9..59a9d8377875ac 100644
--- a/packages/editor/src/components/block-list/layout.js
+++ b/packages/editor/src/components/block-list/layout.js
@@ -27,7 +27,6 @@ import { compose } from '@wordpress/compose';
import BlockListBlock from './block';
import IgnoreNestedEvents from './ignore-nested-events';
import DefaultBlockAppender from '../default-block-appender';
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
class BlockListLayout extends Component {
constructor( props ) {
@@ -239,7 +238,6 @@ class BlockListLayout extends Component {
}
export default compose( [
- withDeprecatedUniqueId,
withSelect( ( select, ownProps ) => {
const {
isSelectionEnabled,
diff --git a/packages/editor/src/components/block-mover/index.js b/packages/editor/src/components/block-mover/index.js
index f1c0af092de823..d28d131cbdfc6c 100644
--- a/packages/editor/src/components/block-mover/index.js
+++ b/packages/editor/src/components/block-mover/index.js
@@ -19,7 +19,6 @@ import { withInstanceId, compose } from '@wordpress/compose';
*/
import { getBlockMoverDescription } from './mover-description';
import { upArrow, downArrow } from './arrows';
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
export class BlockMover extends Component {
constructor() {
@@ -107,7 +106,6 @@ export class BlockMover extends Component {
}
export default compose(
- withDeprecatedUniqueId,
withSelect( ( select, { clientIds, rootClientId } ) => {
const { getBlock, getBlockIndex, getTemplateLock } = select( 'core/editor' );
const firstClientId = first( castArray( clientIds ) );
diff --git a/packages/editor/src/components/block-settings-menu/index.js b/packages/editor/src/components/block-settings-menu/index.js
index 0b5c4d6cdb4338..bf7372600b7167 100644
--- a/packages/editor/src/components/block-settings-menu/index.js
+++ b/packages/editor/src/components/block-settings-menu/index.js
@@ -11,7 +11,6 @@ import { __ } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { IconButton, Dropdown, NavigableMenu } from '@wordpress/components';
import { withDispatch } from '@wordpress/data';
-import { compose } from '@wordpress/compose';
/**
* Internal dependencies
@@ -25,7 +24,6 @@ import BlockHTMLConvertButton from './block-html-convert-button';
import BlockUnknownConvertButton from './block-unknown-convert-button';
import _BlockSettingsMenuFirstItem from './block-settings-menu-first-item';
import _BlockSettingsMenuPluginsExtension from './block-settings-menu-plugins-extension';
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
export class BlockSettingsMenu extends Component {
constructor() {
@@ -148,11 +146,8 @@ export class BlockSettingsMenu extends Component {
}
}
-export default compose( [
- withDeprecatedUniqueId,
- withDispatch( ( dispatch ) => ( {
- onSelect( clientId ) {
- dispatch( 'core/editor' ).selectBlock( clientId );
- },
- } ) ),
-] )( BlockSettingsMenu );
+export default withDispatch( ( dispatch ) => ( {
+ onSelect( clientId ) {
+ dispatch( 'core/editor' ).selectBlock( clientId );
+ },
+} ) )( BlockSettingsMenu );
diff --git a/packages/editor/src/components/block-title/index.js b/packages/editor/src/components/block-title/index.js
index 5c729247d8a257..6629c167684370 100644
--- a/packages/editor/src/components/block-title/index.js
+++ b/packages/editor/src/components/block-title/index.js
@@ -3,12 +3,6 @@
*/
import { withSelect } from '@wordpress/data';
import { getBlockType } from '@wordpress/blocks';
-import { compose } from '@wordpress/compose';
-
-/**
- * Internal dependencies
- */
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
/**
* Renders the block's configured title as a string, or empty if the title
@@ -37,14 +31,11 @@ export function BlockTitle( { name } ) {
return blockType.title;
}
-export default compose( [
- withDeprecatedUniqueId,
- withSelect( ( select, ownProps ) => {
- const { getBlockName } = select( 'core/editor' );
- const { clientId } = ownProps;
+export default withSelect( ( select, ownProps ) => {
+ const { getBlockName } = select( 'core/editor' );
+ const { clientId } = ownProps;
- return {
- name: getBlockName( clientId ),
- };
- } ),
-] )( BlockTitle );
+ return {
+ name: getBlockName( clientId ),
+ };
+} )( BlockTitle );
diff --git a/packages/editor/src/components/default-block-appender/index.js b/packages/editor/src/components/default-block-appender/index.js
index e0eb031c72a3be..fc8dd00203d93f 100644
--- a/packages/editor/src/components/default-block-appender/index.js
+++ b/packages/editor/src/components/default-block-appender/index.js
@@ -20,7 +20,6 @@ import { DotTip } from '@wordpress/nux';
import BlockDropZone from '../block-drop-zone';
import InserterWithShortcuts from '../inserter-with-shortcuts';
import Inserter from '../inserter';
-import withDeprecatedUniqueId from '../with-deprecated-unique-id';
export function DefaultBlockAppender( {
isLocked,
@@ -66,7 +65,6 @@ export function DefaultBlockAppender( {
);
}
export default compose(
- withDeprecatedUniqueId,
withSelect( ( select, ownProps ) => {
const { getBlockCount, getBlock, getEditorSettings, getTemplateLock } = select( 'core/editor' );
const { isTipVisible } = select( 'core/nux' );
diff --git a/packages/editor/src/components/index.js b/packages/editor/src/components/index.js
index 053df2136311db..3e909f4f784f62 100644
--- a/packages/editor/src/components/index.js
+++ b/packages/editor/src/components/index.js
@@ -22,7 +22,7 @@ export { default as RichText } from './rich-text';
export { default as RichTextProvider } from './rich-text/provider';
export { default as MediaPlaceholder } from './media-placeholder';
export { default as MediaUpload } from './media-upload';
-export { default as URLInput, UrlInput } from './url-input';
+export { default as URLInput } from './url-input';
export { default as URLInputButton } from './url-input/button';
// Post Related Components
diff --git a/packages/editor/src/components/media-placeholder/index.js b/packages/editor/src/components/media-placeholder/index.js
index 831280916abc69..f30e68d1cfb6e1 100644
--- a/packages/editor/src/components/media-placeholder/index.js
+++ b/packages/editor/src/components/media-placeholder/index.js
@@ -15,7 +15,6 @@ import {
} from '@wordpress/components';
import { __, sprintf } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
-import deprecated from '@wordpress/deprecated';
/**
* Internal dependencies
@@ -53,26 +52,8 @@ class MediaPlaceholder extends Component {
onSubmitSrc( event ) {
event.preventDefault();
- if ( this.state.src ) {
- if ( this.props.onSelectUrl ) {
- // TODO: In removing deprecation, ensure to simplify rendering
- // to avoid checking for `onSelectUrl`. It also allows this
- // function to be simplified to avoid truthiness test on
- // `onSelectURL`, since it's required for the form invoking
- // this function to be rendered at all.
- deprecated( 'MediaPlaceholder `onSelectUrl` prop', {
- alternative: '`onSelectURL` prop',
- plugin: 'Gutenberg',
- version: 'v3.5',
- hint: 'The prop has been renamed.',
- } );
-
- this.props.onSelectUrl( this.state.src );
- }
-
- if ( this.props.onSelectURL ) {
- this.props.onSelectURL( this.state.src );
- }
+ if ( this.state.src && this.props.onSelectURL ) {
+ this.props.onSelectURL( this.state.src );
}
}
@@ -101,7 +82,6 @@ class MediaPlaceholder extends Component {
onSelect,
value = {},
onSelectURL,
- onSelectUrl,
onHTMLDrop = noop,
multiple = false,
notices,
@@ -120,7 +100,7 @@ class MediaPlaceholder extends Component {
onFilesDrop={ this.onFilesUpload }
onHTMLDrop={ onHTMLDrop }
/>
- { ( onSelectUrl || onSelectURL ) && (
+ { onSelectURL && (
` );
@@ -59,8 +55,6 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
} );
// clientId will always be random.
secondExpectedBlock.clientId = transformed[ 3 ].clientId;
- // TODO: Remove in 3.5 "UID" deprecation.
- secondExpectedBlock.uid = secondExpectedBlock.clientId;
expect( transformed[ 3 ] ).toEqual( secondExpectedBlock );
expect( transformed[ 4 ] ).toEqual( '
' );
expect( transformed ).toHaveLength( 5 );
@@ -79,8 +73,6 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
} );
// clientId will always be random.
firstExpectedBlock.clientId = transformed[ 1 ].clientId;
- // TODO: Remove in 3.5 "UID" deprecation.
- firstExpectedBlock.uid = firstExpectedBlock.clientId;
expect( transformed[ 1 ] ).toEqual( firstExpectedBlock );
expect( transformed[ 2 ] ).toEqual( `
` );
@@ -89,8 +81,6 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
} );
// clientId will always be random.
secondExpectedBlock.clientId = transformed[ 3 ].clientId;
- // TODO: Remove in 3.5 "UID" deprecation.
- secondExpectedBlock.uid = secondExpectedBlock.clientId;
expect( transformed[ 3 ] ).toEqual( secondExpectedBlock );
expect( transformed[ 4 ] ).toEqual( `
` );
@@ -99,8 +89,6 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
} );
// clientId will always be random.
thirdExpectedBlock.clientId = transformed[ 5 ].clientId;
- // TODO: Remove in 3.5 "UID" deprecation.
- thirdExpectedBlock.uid = thirdExpectedBlock.clientId;
expect( transformed[ 5 ] ).toEqual( thirdExpectedBlock );
expect( transformed[ 6 ] ).toEqual( `
` );
@@ -109,8 +97,6 @@ describe( 'segmentHTMLToShortcodeBlock', () => {
} );
// clientId will always be random.
fourthExpectedBlock.clientId = transformed[ 7 ].clientId;
- // TODO: Remove in 3.5 "UID" deprecation.
- fourthExpectedBlock.uid = fourthExpectedBlock.clientId;
expect( transformed[ 7 ] ).toEqual( fourthExpectedBlock );
expect( transformed[ 8 ] ).toEqual( '
' );
expect( transformed ).toHaveLength( 9 );
diff --git a/utils/deprecated.js b/utils/deprecated.js
deleted file mode 100644
index 639fe9e65873a6..00000000000000
--- a/utils/deprecated.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/**
- * External dependencies
- */
-import { groupBy } from 'lodash';
-
-/**
- * WordPress dependencies
- */
-import { decodeEntities as decodeEntitiesSource } from '@wordpress/html-entities';
-import deprecated from '@wordpress/deprecated';
-
-/**
- * Returns terms in a tree form.
- *
- * @param {Array} flatTerms Array of terms in flat format.
- *
- * @return {Array} Array of terms in tree format.
- */
-export function buildTermsTree( flatTerms ) {
- deprecated( 'wp.utils.buildTermsTree', {
- version: '3.5',
- plugin: 'Gutenberg',
- } );
- const termsByParent = groupBy( flatTerms, 'parent' );
- const fillWithChildren = ( terms ) => {
- return terms.map( ( term ) => {
- const children = termsByParent[ term.id ];
- return {
- ...term,
- children: children && children.length ?
- fillWithChildren( children ) :
- [],
- };
- } );
- };
-
- return fillWithChildren( termsByParent[ '0' ] || [] );
-}
-
-// entities
-export function decodeEntities( html ) {
- deprecated( 'wp.utils.decodeEntities', {
- version: '3.5',
- alternative: 'wp.htmlEntities.decodeEntities',
- plugin: 'Gutenberg',
- } );
- return decodeEntitiesSource( html );
-}
diff --git a/utils/index.js b/utils/index.js
index d206dc2362eea7..027b1e0484a3e3 100644
--- a/utils/index.js
+++ b/utils/index.js
@@ -1,3 +1,2 @@
// Deprecations
-export * from './deprecated';
export * from './mediaupload';