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