Skip to content

Commit

Permalink
Add block transform to transform preformatted block into code block.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocean90 committed Jun 4, 2020
1 parent ac64aca commit d9dffdc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/block-library/src/preformatted/transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,11 @@ const transforms = {
transform: ( attributes ) =>
createBlock( 'core/paragraph', attributes ),
},
{
type: 'block',
blocks: [ 'core/code' ],
transform: ( attributes ) => createBlock( 'core/code', attributes ),
},
],
};

Expand Down
2 changes: 1 addition & 1 deletion packages/e2e-tests/fixtures/block-transforms.js
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,7 @@ export const EXPECTED_TRANSFORMS = {
},
core__preformatted: {
originalBlock: 'Preformatted',
availableTransforms: [ 'Group', 'Paragraph' ],
availableTransforms: [ 'Group', 'Paragraph', 'Code' ],
},
core__pullquote: {
originalBlock: 'Pullquote',
Expand Down

0 comments on commit d9dffdc

Please sign in to comment.