/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/block-library/src/preformatted/edit.js
43 строки
980 B
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'; export default function PreformattedEdit( { attributes, mergeBlocks, setAttributes, onRemove, insertBlocksAfter, style, } ) { const { content } = attributes; const blockProps = useBlockProps( { style } ); return ( <RichText tagName="pre" identifier="content" preserveWhiteSpace value={ content } onChange={ ( nextContent ) => { setAttributes( { content: nextContent, } ); } } onRemove={ onRemove } aria-label={ __( 'Preformatted text' ) } placeholder={ __( 'Write preformatted text…' ) } onMerge={ mergeBlocks } { ...blockProps } __unstablePastePlainText __unstableOnSplitAtDoubleLineEnd={ insertBlocksAfter ? () => insertBlocksAfter( createBlock( getDefaultBlockName() ) ) : undefined } /> ); }