diff --git a/packages/block-editor/src/components/plain-text/README.md b/packages/block-editor/src/components/plain-text/README.md index 64d1c04b5c09bc..5c808edd9018b2 100644 --- a/packages/block-editor/src/components/plain-text/README.md +++ b/packages/block-editor/src/components/plain-text/README.md @@ -35,6 +35,7 @@ wp.blocks.registerBlockType( /* ... */, { edit: function( props ) { return wp.element.createElement( wp.editor.PlainText, { + version: 2, className: props.className, value: props.attributes.content, onChange: function( content ) { @@ -63,6 +64,7 @@ registerBlockType( /* ... */, { edit( { className, attributes, setAttributes } ) { return ( setAttributes( { content } ) } diff --git a/packages/block-editor/src/components/plain-text/index.js b/packages/block-editor/src/components/plain-text/index.js index 2a4e1b423e6094..400fd2ef1737df 100644 --- a/packages/block-editor/src/components/plain-text/index.js +++ b/packages/block-editor/src/components/plain-text/index.js @@ -7,6 +7,7 @@ import classnames from 'classnames'; /** * WordPress dependencies */ +import deprecated from '@wordpress/deprecated'; import { forwardRef } from '@wordpress/element'; /** @@ -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 ( diff --git a/packages/block-library/src/comments-pagination-next/edit.js b/packages/block-library/src/comments-pagination-next/edit.js index 56a98a621134eb..f5ab0a702aa1b7 100644 --- a/packages/block-library/src/comments-pagination-next/edit.js +++ b/packages/block-library/src/comments-pagination-next/edit.js @@ -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' ) } diff --git a/packages/block-library/src/comments-pagination-previous/edit.js b/packages/block-library/src/comments-pagination-previous/edit.js index 1b644a746e6f25..c27d910022b890 100644 --- a/packages/block-library/src/comments-pagination-previous/edit.js +++ b/packages/block-library/src/comments-pagination-previous/edit.js @@ -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' ) } diff --git a/packages/block-library/src/html/edit.js b/packages/block-library/src/html/edit.js index 5cb2b457633b13..d915523de5ddcd 100644 --- a/packages/block-library/src/html/edit.js +++ b/packages/block-library/src/html/edit.js @@ -54,6 +54,7 @@ export default function HTMLEdit( { attributes, setAttributes, isSelected } ) { /> ) : ( <PlainText + version={ 2 } value={ attributes.content } onChange={ ( content ) => setAttributes( { content } ) } placeholder={ __( 'Write HTML…' ) } diff --git a/packages/block-library/src/post-title/edit.js b/packages/block-library/src/post-title/edit.js index 6f16fc5ed7f467..e1dd4e74f9eff3 100644 --- a/packages/block-library/src/post-title/edit.js +++ b/packages/block-library/src/post-title/edit.js @@ -52,11 +52,11 @@ export default function PostTitleEdit( { titleElement = userCanEdit && ! isDescendentOfQueryLoop ? ( <PlainText + version={ 2 } tagName={ TagName } placeholder={ __( 'No Title' ) } value={ rawTitle } onChange={ setTitle } - __experimentalVersion={ 2 } { ...blockProps } /> ) : ( @@ -72,6 +72,7 @@ export default function PostTitleEdit( { userCanEdit && ! isDescendentOfQueryLoop ? ( <TagName { ...blockProps }> <PlainText + version={ 2 } tagName="a" href={ link } target={ linkTarget } @@ -81,7 +82,6 @@ export default function PostTitleEdit( { } value={ rawTitle } onChange={ setTitle } - __experimentalVersion={ 2 } /> </TagName> ) : ( diff --git a/packages/block-library/src/query-pagination-next/edit.js b/packages/block-library/src/query-pagination-next/edit.js index c0b4916abccb3d..35f6e8142c7f28 100644 --- a/packages/block-library/src/query-pagination-next/edit.js +++ b/packages/block-library/src/query-pagination-next/edit.js @@ -23,7 +23,7 @@ export default function QueryPaginationNextEdit( { { ...useBlockProps() } > <PlainText - __experimentalVersion={ 2 } + version={ 2 } tagName="span" aria-label={ __( 'Next page link' ) } placeholder={ __( 'Next Page' ) } diff --git a/packages/block-library/src/query-pagination-previous/edit.js b/packages/block-library/src/query-pagination-previous/edit.js index c863d637f7fb51..adfda483c52351 100644 --- a/packages/block-library/src/query-pagination-previous/edit.js +++ b/packages/block-library/src/query-pagination-previous/edit.js @@ -31,7 +31,7 @@ export default function QueryPaginationPreviousEdit( { </span> ) } <PlainText - __experimentalVersion={ 2 } + version={ 2 } tagName="span" aria-label={ __( 'Previous page link' ) } placeholder={ __( 'Previous Page' ) } diff --git a/packages/block-library/src/shortcode/edit.js b/packages/block-library/src/shortcode/edit.js index aecebd115a983f..453df763f5d70d 100644 --- a/packages/block-library/src/shortcode/edit.js +++ b/packages/block-library/src/shortcode/edit.js @@ -20,6 +20,7 @@ export default function ShortcodeEdit( { attributes, setAttributes } ) { { __( 'Shortcode' ) } </label> <PlainText + version={ 2 } className="blocks-shortcode__textarea" id={ inputId } value={ attributes.text } diff --git a/packages/block-library/src/shortcode/edit.native.js b/packages/block-library/src/shortcode/edit.native.js index 165a103035155c..091391779ef005 100644 --- a/packages/block-library/src/shortcode/edit.native.js +++ b/packages/block-library/src/shortcode/edit.native.js @@ -58,7 +58,7 @@ export function ShortcodeEdit( props ) { <Text style={ titleStyle }>{ __( 'Shortcode' ) }</Text> <View style={ shortcodeContainerStyle }> <PlainText - __experimentalVersion={ 2 } + version={ 2 } value={ attributes.text } style={ shortcodeStyle } onChange={ onChange }