diff --git a/packages/block-library/src/text-columns/index.js b/packages/block-library/src/text-columns/index.js index 8b51f9db8c471d..10e205c1d96e22 100644 --- a/packages/block-library/src/text-columns/index.js +++ b/packages/block-library/src/text-columns/index.js @@ -6,6 +6,7 @@ import { get, times } from 'lodash'; /** * WordPress dependencies */ +import { createBlock } from '@wordpress/blocks'; import { __ } from '@wordpress/i18n'; import { PanelBody, RangeControl } from '@wordpress/components'; import { Fragment } from '@wordpress/element'; @@ -54,6 +55,32 @@ export const settings = { }, }, + transforms: { + to: [ + { + type: 'block', + blocks: [ 'core/columns' ], + transform: ( { className, columns, content, width } ) => ( + createBlock( + 'core/columns', + { + align: ( 'wide' === width || 'full' === width ) ? width : undefined, + className, + columns, + }, + content.map( ( { children } ) => + createBlock( + 'core/column', + {}, + [ createBlock( 'core/paragraph', { content: children } ) ] + ) + ) + ) + ), + }, + ], + }, + getEditWrapperProps( attributes ) { const { width } = attributes; if ( 'wide' === width || 'full' === width ) {