Skip to content

Commit

Permalink
Remove small APIs marked to be removed in WP 6.2 (#46106)
Browse files Browse the repository at this point in the history
  • Loading branch information
youknowriad authored Dec 7, 2022
1 parent d5dcbd1 commit ae36680
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 38 deletions.
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/rich-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ function RichTextWrapper(
onReplace,
placeholder,
allowedFormats,
formattingControls,
withoutInteractiveFormatting,
onRemove,
onMerge,
Expand Down Expand Up @@ -166,7 +165,6 @@ function RichTextWrapper(
const multilineTag = getMultilineTag( multiline );
const adjustedAllowedFormats = getAllowedFormats( {
allowedFormats,
formattingControls,
disableFormats,
} );
const hasFormats =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ function RichTextWrapper(
onReplace,
placeholder,
allowedFormats,
formattingControls,
withoutInteractiveFormatting,
onRemove,
onMerge,
Expand Down Expand Up @@ -194,7 +193,6 @@ function RichTextWrapper(
const multilineTag = getMultilineTag( multiline );
const adjustedAllowedFormats = getAllowedFormats( {
allowedFormats,
formattingControls,
disableFormats,
} );
const hasFormats =
Expand Down
23 changes: 2 additions & 21 deletions packages/block-editor/src/components/rich-text/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -34,30 +33,12 @@ 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 ) {
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 = [];
Expand Down
14 changes: 1 addition & 13 deletions packages/server-side-render/src/index.js
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -47,15 +46,4 @@ const ExportedServerSideRender = withSelect( ( select ) => {
return <ServerSideRender urlQueryArgs={ newUrlQueryArgs } { ...props } />;
} );

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 <ExportedServerSideRender { ...props } ref={ ref } />;
} );
}

export default ExportedServerSideRender;

0 comments on commit ae36680

Please sign in to comment.