import { __ } from '@wordpress/i18n'; import { RichText, useBlockProps } from '@wordpress/block-editor'; import type { BlockEditProps } from '@wordpress/blocks'; import { createBlock, getDefaultBlockName } from '@wordpress/blocks'; import { Figure } from './figure'; import { BlockQuote } from './blockquote'; import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes'; import type { PullQuoteAttributes } from './types'; function PullQuoteEdit( props: BlockEditProps< PullQuoteAttributes > ) { const { attributes, setAttributes, isSelected, insertBlocksAfter } = props; useDeprecatedTextAlign( props ); const { citation, value } = attributes; const blockProps = useBlockProps(); const shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected; return ( <>
setAttributes( { value: nextValue, } ) } aria-label={ __( 'Pullquote text' ) } placeholder={ // translators: placeholder text used for the quote __( 'Add quote' ) } /> { shouldShowCitation && ( setAttributes( { citation: nextCitation, } ) } className="wp-block-pullquote__citation" __unstableOnSplitAtEnd={ insertBlocksAfter ? () => insertBlocksAfter( createBlock( getDefaultBlockName()! ) ) : undefined } /> ) }
); } export default PullQuoteEdit;