Skip to content

Commit

Permalink
Post Author Name: Add to and from Post Author transformations
Browse files Browse the repository at this point in the history
  • Loading branch information
Mamaduka committed May 19, 2022
1 parent aa1f770 commit 140528b
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
2 changes: 2 additions & 0 deletions packages/block-library/src/post-author-name/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*/
import metadata from './block.json';
import edit from './edit';
import transforms from './transforms';

/**
* WordPress dependencies
Expand All @@ -14,5 +15,6 @@ export { metadata, name };

export const settings = {
icon,
transforms,
edit,
};
25 changes: 25 additions & 0 deletions packages/block-library/src/post-author-name/transforms.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* WordPress dependencies
*/
import { createBlock } from '@wordpress/blocks';

const transforms = {
from: [
{
type: 'block',
blocks: [ 'core/post-author' ],
transform: ( { textAlign } ) =>
createBlock( 'core/post-author-name', { textAlign } ),
},
],
to: [
{
type: 'block',
blocks: [ 'core/post-author' ],
transform: ( { textAlign } ) =>
createBlock( 'core/post-author', { textAlign } ),
},
],
};

export default transforms;

0 comments on commit 140528b

Please sign in to comment.