Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,16 @@ exports[`Quote block transforms to Group block 1`] = `
<!-- /wp:group -->"
`;

exports[`Quote block transforms to Paragraph block 1`] = `
"<!-- wp:paragraph -->
<p>"This will make running your own blog a viable alternative again."</p>
<!-- /wp:paragraph -->

<!-- wp:paragraph -->
<p>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></p>
<!-- /wp:paragraph -->"
`;

exports[`Quote block transforms to Pullquote block 1`] = `
"<!-- wp:pullquote -->
<figure class="wp-block-pullquote"><blockquote><p>"This will make running your own blog a viable alternative again."</p><cite>— <a href="https://twitter.com/azumbrunnen_/status/1019347243084800005">Adrian Zumbrunnen</a></cite></blockquote></figure>
Expand Down
6 changes: 5 additions & 1 deletion packages/block-library/src/quote/test/transforms.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,11 @@ const initialHtml = `
<!-- /wp:quote -->`;

const transformsWithInnerBlocks = [ 'Columns', 'Group' ];
const blockTransforms = [ 'Pullquote', ...transformsWithInnerBlocks ];
const blockTransforms = [
'Pullquote',
'Paragraph',
...transformsWithInnerBlocks,
];

setupCoreBlocks();

Expand Down
13 changes: 13 additions & 0 deletions packages/block-library/src/quote/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,19 @@ const transforms = {
} );
},
},
{
type: 'block',
blocks: [ 'core/paragraph' ],
transform: ( { citation }, innerBlocks ) =>
citation
? [
...innerBlocks,
createBlock( 'core/paragraph', {
content: citation,
} ),
]
: innerBlocks,
},
{
type: 'block',
blocks: [ 'core/group' ],
Expand Down