diff --git a/components/autocomplete/completer-compat.js b/components/autocomplete/completer-compat.js deleted file mode 100644 index aedffd61b16d9d..00000000000000 --- a/components/autocomplete/completer-compat.js +++ /dev/null @@ -1,61 +0,0 @@ -/** - * This mod - */ - -/** - * WordPress dependencies. - */ -import { deprecated } from '@wordpress/utils'; - -const generateCompleterName = ( () => { - let count = 0; - return () => `backcompat-completer-${ count++ }`; -} )(); - -export function isDeprecatedCompleter( completer ) { - return 'onSelect' in completer; -} - -export function toCompatibleCompleter( deprecatedCompleter ) { - deprecated( 'Original autocompleter interface in wp.components.Autocomplete', { - version: '2.8', - alternative: 'latest autocompleter interface', - plugin: 'Gutenberg', - link: 'https://github.com/WordPress/gutenberg/blob/master/components/autocomplete/README.md', - } ); - - const optionalProperties = [ 'className', 'allowNode', 'allowContext' ] - .filter( ( key ) => key in deprecatedCompleter ) - .reduce( ( properties, key ) => { - return { - ...properties, - [ key ]: deprecatedCompleter[ key ], - }; - }, {} ); - - return { - name: generateCompleterName(), - triggerPrefix: deprecatedCompleter.triggerPrefix, - - options() { - return deprecatedCompleter.getOptions(); - }, - - getOptionLabel( option ) { - return option.label; - }, - - getOptionKeywords( option ) { - return option.keywords; - }, - - getOptionCompletion() { - return { - action: 'backcompat', - value: deprecatedCompleter.onSelect.bind( deprecatedCompleter ), - }; - }, - - ...optionalProperties, - }; -} diff --git a/components/autocomplete/index.js b/components/autocomplete/index.js index 514c0e55bf4566..b08b10899105b3 100644 --- a/components/autocomplete/index.js +++ b/components/autocomplete/index.js @@ -15,7 +15,6 @@ import { __, _n, sprintf } from '@wordpress/i18n'; * Internal dependencies */ import './style.scss'; -import { isDeprecatedCompleter, toCompatibleCompleter } from './completer-compat'; import withFocusOutside from '../higher-order/with-focus-outside'; import Button from '../button'; import Popover from '../popover'; @@ -207,36 +206,6 @@ export class Autocomplete extends Component { }; } - /* - * NOTE: This is necessary for backwards compatibility with the - * previous completer interface. Once we no longer support the - * old interface, we should be able to use the `completers` prop - * directly. - */ - static getDerivedStateFromProps( nextProps, prevState ) { - const { completers: nextCompleters } = nextProps; - const { lastAppliedCompleters } = prevState; - - if ( nextCompleters !== lastAppliedCompleters ) { - let completers = nextCompleters; - - if ( completers.some( isDeprecatedCompleter ) ) { - completers = completers.map( ( completer ) => { - return isDeprecatedCompleter( completer ) ? - toCompatibleCompleter( completer ) : - completer; - } ); - } - - return { - completers, - lastAppliedCompleters: nextCompleters, - }; - } - - return null; - } - constructor() { super( ...arguments ); @@ -466,7 +435,8 @@ export class Autocomplete extends Component { } search( event ) { - const { completers, open: wasOpen, suppress: wasSuppress, query: wasQuery } = this.state; + const { completers } = this.props; + const { open: wasOpen, suppress: wasSuppress, query: wasQuery } = this.state; const container = event.target; // ensure that the cursor location is unambiguous diff --git a/editor/store/selectors.js b/editor/store/selectors.js index 5c7978d7459972..7e2ad7981747f8 100644 --- a/editor/store/selectors.js +++ b/editor/store/selectors.js @@ -26,7 +26,6 @@ import { serialize, getBlockType, getBlockTypes } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; import { moment } from '@wordpress/date'; -import { deprecated } from '@wordpress/utils'; /*** * Module constants @@ -1294,15 +1293,6 @@ function buildInserterItemFromSharedBlock( state, allowedBlockTypes, sharedBlock * @return {Editor.InserterItem[]} Items that appear in inserter. */ export function getInserterItems( state, allowedBlockTypes ) { - if ( allowedBlockTypes === undefined ) { - allowedBlockTypes = true; - deprecated( 'getInserterItems with no allowedBlockTypes argument', { - version: '2.8', - alternative: 'getInserterItems with an explcit allowedBlockTypes argument', - plugin: 'Gutenberg', - } ); - } - if ( ! allowedBlockTypes ) { return []; } @@ -1364,15 +1354,6 @@ function getItemsFromInserts( state, inserts, allowedBlockTypes, maximum = MAX_R * @return {Editor.InserterItem[]} Items that appear in the 'Recent' tab. */ export function getFrecentInserterItems( state, allowedBlockTypes, maximum = MAX_RECENT_BLOCKS ) { - if ( allowedBlockTypes === undefined ) { - allowedBlockTypes = true; - deprecated( 'getFrecentInserterItems with no allowedBlockTypes argument', { - version: '2.8', - alternative: 'getFrecentInserterItems with an explcit allowedBlockTypes argument', - plugin: 'Gutenberg', - } ); - } - const calculateFrecency = ( time, count ) => { if ( ! time ) { return count;