/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/block-library/src/pullquote/edit.js
69 строк
2 KB
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { __ } from '@wordpress/i18n'; import { RichText, useBlockProps } from '@wordpress/block-editor'; import { createBlock, getDefaultBlockName } from '@wordpress/blocks'; import { Figure } from './figure'; import { BlockQuote } from './blockquote'; import useDeprecatedTextAlign from '../utils/deprecated-text-align-attributes'; function PullQuoteEdit( props ) { const { attributes, setAttributes, isSelected, insertBlocksAfter } = props; useDeprecatedTextAlign( props ); const { citation, value } = attributes; const blockProps = useBlockProps(); const shouldShowCitation = ! RichText.isEmpty( citation ) || isSelected; return ( <> <Figure { ...blockProps }> <BlockQuote> <RichText identifier="value" tagName="p" value={ value } onChange={ ( nextValue ) => setAttributes( { value: nextValue, } ) } aria-label={ __( 'Pullquote text' ) } placeholder={ // translators: placeholder text used for the quote __( 'Add quote' ) } /> { shouldShowCitation && ( <RichText identifier="citation" tagName="cite" style={ { display: 'block' } } value={ citation } aria-label={ __( 'Pullquote citation text' ) } placeholder={ // translators: placeholder text used for the citation __( 'Add citation' ) } onChange={ ( nextCitation ) => setAttributes( { citation: nextCitation, } ) } className="wp-block-pullquote__citation" __unstableOnSplitAtEnd={ insertBlocksAfter ? () => insertBlocksAfter( createBlock( getDefaultBlockName() ) ) : undefined } /> ) } </BlockQuote> </Figure> </> ); } export default PullQuoteEdit;