Skip to content

Commit

Permalink
[Block Library - Quote]: Restrict single block transforms to specific…
Browse files Browse the repository at this point in the history
… blocks (#44106)
  • Loading branch information
ntsekouras authored Sep 13, 2022
1 parent 8247dd0 commit 5ee0a7f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions packages/block-library/src/quote/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,16 @@ const transforms = {
isMultiBlock: true,
blocks: [ '*' ],
isMatch: ( {}, blocks ) => {
// When a single block is selected make the tranformation
// available only to specific blocks that make sense.
if ( blocks.length === 1 ) {
return [
'core/paragraph',
'core/heading',
'core/list',
'core/pullquote',
].includes( blocks[ 0 ].name );
}
return ! blocks.some( ( { name } ) => name === 'core/quote' );
},
__experimentalConvert: ( blocks ) =>
Expand Down

0 comments on commit 5ee0a7f

Please sign in to comment.