From caf653fa92e0076a9d6f54f3f65b137d33e48f7f Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Mon, 28 Nov 2022 09:59:54 +0100 Subject: [PATCH 1/2] Remove small APIs marked to be removed in WP 6.2 --- .../src/components/rich-text/index.js | 2 -- .../src/components/rich-text/index.native.js | 2 -- .../src/components/rich-text/utils.js | 21 +++---------------- packages/server-side-render/src/index.js | 14 +------------ 4 files changed, 4 insertions(+), 35 deletions(-) diff --git a/packages/block-editor/src/components/rich-text/index.js b/packages/block-editor/src/components/rich-text/index.js index 8378c3718d33fc..726f8cddfff7b7 100644 --- a/packages/block-editor/src/components/rich-text/index.js +++ b/packages/block-editor/src/components/rich-text/index.js @@ -98,7 +98,6 @@ function RichTextWrapper( onReplace, placeholder, allowedFormats, - formattingControls, withoutInteractiveFormatting, onRemove, onMerge, @@ -166,7 +165,6 @@ function RichTextWrapper( const multilineTag = getMultilineTag( multiline ); const adjustedAllowedFormats = getAllowedFormats( { allowedFormats, - formattingControls, disableFormats, } ); const hasFormats = diff --git a/packages/block-editor/src/components/rich-text/index.native.js b/packages/block-editor/src/components/rich-text/index.native.js index 45826129017a86..1ea26ddcf77750 100644 --- a/packages/block-editor/src/components/rich-text/index.native.js +++ b/packages/block-editor/src/components/rich-text/index.native.js @@ -75,7 +75,6 @@ function RichTextWrapper( onReplace, placeholder, allowedFormats, - formattingControls, withoutInteractiveFormatting, onRemove, onMerge, @@ -194,7 +193,6 @@ function RichTextWrapper( const multilineTag = getMultilineTag( multiline ); const adjustedAllowedFormats = getAllowedFormats( { allowedFormats, - formattingControls, disableFormats, } ); const hasFormats = diff --git a/packages/block-editor/src/components/rich-text/utils.js b/packages/block-editor/src/components/rich-text/utils.js index 6c8275d930eebf..8849278938ec86 100644 --- a/packages/block-editor/src/components/rich-text/utils.js +++ b/packages/block-editor/src/components/rich-text/utils.js @@ -2,7 +2,6 @@ * WordPress dependencies */ import { regexp } from '@wordpress/shortcode'; -import deprecated from '@wordpress/deprecated'; import { renderToString } from '@wordpress/element'; import { createBlock } from '@wordpress/blocks'; @@ -34,30 +33,16 @@ export function getMultilineTag( multiline ) { return multiline === true ? 'p' : multiline; } -export function getAllowedFormats( { - allowedFormats, - formattingControls, - disableFormats, -} ) { +export function getAllowedFormats( { allowedFormats, disableFormats } ) { if ( disableFormats ) { return getAllowedFormats.EMPTY_ARRAY; } - if ( ! allowedFormats && ! formattingControls ) { + if ( ! allowedFormats ) { return; } - if ( allowedFormats ) { - return allowedFormats; - } - - deprecated( 'wp.blockEditor.RichText formattingControls prop', { - since: '5.4', - alternative: 'allowedFormats', - version: '6.2', - } ); - - return formattingControls.map( ( name ) => `core/${ name }` ); + return allowedFormats; } getAllowedFormats.EMPTY_ARRAY = []; diff --git a/packages/server-side-render/src/index.js b/packages/server-side-render/src/index.js index 80e0033707cd90..6dcdc31f461091 100644 --- a/packages/server-side-render/src/index.js +++ b/packages/server-side-render/src/index.js @@ -1,9 +1,8 @@ /** * WordPress dependencies */ -import { useMemo, forwardRef } from '@wordpress/element'; +import { useMemo } from '@wordpress/element'; import { withSelect } from '@wordpress/data'; -import deprecated from '@wordpress/deprecated'; /** * Internal dependencies @@ -47,15 +46,4 @@ const ExportedServerSideRender = withSelect( ( select ) => { return ; } ); -if ( window && window.wp && window.wp.components ) { - window.wp.components.ServerSideRender = forwardRef( ( props, ref ) => { - deprecated( 'wp.components.ServerSideRender', { - version: '6.2', - since: '5.3', - alternative: 'wp.serverSideRender', - } ); - return ; - } ); -} - export default ExportedServerSideRender; From 92679c0abd169677180977dba581dcee6673a763 Mon Sep 17 00:00:00 2001 From: Riad Benguella Date: Wed, 7 Dec 2022 10:28:58 +0100 Subject: [PATCH 2/2] Simplification --- packages/block-editor/src/components/rich-text/utils.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/block-editor/src/components/rich-text/utils.js b/packages/block-editor/src/components/rich-text/utils.js index 8849278938ec86..323af1c6c36e07 100644 --- a/packages/block-editor/src/components/rich-text/utils.js +++ b/packages/block-editor/src/components/rich-text/utils.js @@ -38,10 +38,6 @@ export function getAllowedFormats( { allowedFormats, disableFormats } ) { return getAllowedFormats.EMPTY_ARRAY; } - if ( ! allowedFormats ) { - return; - } - return allowedFormats; }