/
githubmirror
/
gutenberg
Обзор
Документация
Войти
/
githubmirror
/
gutenberg
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
trunk
packages/block-library/src/more/transforms.js
29 строк
661 B
Marco Ciampini
ESLint: Replace strict config with bulk suppressions (#81248)
07 авг 2026, 14:34
Не верифицирован
07 авг 2026, 14:34
7f43eaf
Код
Авторство
О чём код?
import { createBlock } from '@wordpress/blocks'; const transforms = { from: [ { type: 'raw', schema: { 'wp-block': { attributes: [ 'data-block' ] }, }, isMatch: ( node ) => node.dataset && node.dataset.block === 'core/more', transform( node ) { const { customText, noTeaser } = node.dataset; const attrs = {}; // Don't copy unless defined and not an empty string. if ( customText ) { attrs.customText = customText; } // Special handling for boolean. if ( noTeaser === '' ) { attrs.noTeaser = true; } return createBlock( 'core/more', attrs ); }, }, ], }; export default transforms;