Skip to content

Commit

Permalink
Stabilize PlainText v2 and deprecate v1.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebulanStanphill committed Aug 8, 2022
1 parent 433ff76 commit 218c54e
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 8 deletions.
10 changes: 8 additions & 2 deletions packages/block-editor/src/components/plain-text/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import classnames from 'classnames';
/**
* WordPress dependencies
*/
import deprecated from '@wordpress/deprecated';
import { forwardRef } from '@wordpress/element';

/**
Expand All @@ -17,11 +18,16 @@ import EditableText from '../editable-text';
/**
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md
*/
const PlainText = forwardRef( ( { __experimentalVersion, ...props }, ref ) => {
if ( __experimentalVersion === 2 ) {
const PlainText = forwardRef( ( { version, ...props }, ref ) => {
if ( version === 2 ) {
return <EditableText ref={ ref } { ...props } />;
}

deprecated( 'Version 1 of `<PlainText>`', {
since: '6.0',
alternative: '`version={2}`',
} );

const { className, onChange, ...remainingProps } = props;

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function CommentsPaginationNextEdit( {
{ ...useBlockProps() }
>
<PlainText
__experimentalVersion={ 2 }
version={ 2 }
tagName="span"
aria-label={ __( 'Newer comments page link' ) }
placeholder={ __( 'Newer Comments' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export default function CommentsPaginationPreviousEdit( {
</span>
) }
<PlainText
__experimentalVersion={ 2 }
version={ 2 }
tagName="span"
aria-label={ __( 'Older comments page link' ) }
placeholder={ __( 'Older Comments' ) }
Expand Down
4 changes: 2 additions & 2 deletions packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function PostTitleEdit( {
placeholder={ __( 'No Title' ) }
value={ rawTitle }
onChange={ setTitle }
__experimentalVersion={ 2 }
version={ 2 }
{ ...blockProps }
/>
) : (
Expand All @@ -81,7 +81,7 @@ export default function PostTitleEdit( {
}
value={ rawTitle }
onChange={ setTitle }
__experimentalVersion={ 2 }
version={ 2 }
/>
</TagName>
) : (
Expand Down
2 changes: 1 addition & 1 deletion packages/block-library/src/query-pagination-next/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default function QueryPaginationNextEdit( {
{ ...useBlockProps() }
>
<PlainText
__experimentalVersion={ 2 }
version={ 2 }
tagName="span"
aria-label={ __( 'Next page link' ) }
placeholder={ __( 'Next Page' ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export default function QueryPaginationPreviousEdit( {
</span>
) }
<PlainText
__experimentalVersion={ 2 }
version={ 2 }
tagName="span"
aria-label={ __( 'Previous page link' ) }
placeholder={ __( 'Previous Page' ) }
Expand Down

0 comments on commit 218c54e

Please sign in to comment.