Skip to content

Commit

Permalink
Add transform between Tag Cloud and Categories (#38566)
Browse files Browse the repository at this point in the history
  • Loading branch information
ntsekouras authored Feb 7, 2022
1 parent 241e063 commit c86a198
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/block-library/src/tag-cloud/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { tag as icon } from '@wordpress/icons';
/**
* Internal dependencies
*/
import transforms from './transforms';
import metadata from './block.json';
import edit from './edit';

Expand All @@ -17,4 +18,5 @@ export const settings = {
icon,
example: {},
edit,
transforms,
};
23 changes: 23 additions & 0 deletions packages/block-library/src/tag-cloud/transforms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/**
* WordPress dependencies
*/
import { createBlock } from '@wordpress/blocks';

const transforms = {
from: [
{
type: 'block',
blocks: [ 'core/categories' ],
transform: () => createBlock( 'core/tag-cloud' ),
},
],
to: [
{
type: 'block',
blocks: [ 'core/categories' ],
transform: () => createBlock( 'core/categories' ),
},
],
};

export default transforms;

0 comments on commit c86a198

Please sign in to comment.