@gechiui/block-editor
Version:
38 lines (31 loc) • 880 B
JavaScript
/**
* External dependencies
*/
import TextareaAutosize from 'react-autosize-textarea';
import classnames from 'classnames';
/**
* GeChiUI dependencies
*/
import { forwardRef } from '@gechiui/element';
/**
* Internal dependencies
*/
import EditableText from '../editable-text';
/**
* @see https://github.com/GeChiUI/gutenberg/blob/HEAD/packages/block-editor/src/components/plain-text/README.md
*/
const PlainText = forwardRef( ( { __experimentalVersion, ...props }, ref ) => {
if ( __experimentalVersion === 2 ) {
return <EditableText ref={ ref } { ...props } />;
}
const { className, onChange, ...remainingProps } = props;
return (
<TextareaAutosize
ref={ ref }
className={ classnames( 'block-editor-plain-text', className ) }
onChange={ ( event ) => onChange( event.target.value ) }
{ ...remainingProps }
/>
);
} );
export default PlainText;