Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 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
13 changes: 12 additions & 1 deletion packages/block-library/src/post-tags/block.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,20 @@
{
"name": "core/post-tags",
"category": "design",
"attributes": {
"textAlign": {
"type": "string"
}
},
"usesContext": [ "postId", "postType" ],
"supports": {
"html": false,
"lightBlockWrapper": true
"lightBlockWrapper": true,
"__experimentalFontSize": true,
"__experimentalColor": {
"gradients": true,
"linkColor": true
},
"__experimentalLineHeight": true
}
}
36 changes: 33 additions & 3 deletions packages/block-library/src/post-tags/edit.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { useEntityProp } from '@wordpress/core-data';
import { Warning, __experimentalBlock as Block } from '@wordpress/block-editor';
import {
BlockControls,
Warning,
__experimentalBlock as Block,
AlignmentToolbar,
} from '@wordpress/block-editor';
import { useSelect } from '@wordpress/data';
import { __ } from '@wordpress/i18n';

export default function PostTagsEdit( { context } ) {
export default function PostTagsEdit( { context, attributes, setAttributes } ) {
const { textAlign } = attributes;

const [ tags ] = useEntityProp(
'postType',
context.postType,
Expand Down Expand Up @@ -65,5 +77,23 @@ export default function PostTagsEdit( { context } ) {
);
}

return <Block.div>{ display }</Block.div>;
return (
<>
<BlockControls>
<AlignmentToolbar
value={ textAlign }
onChange={ ( nextAlign ) => {
setAttributes( { textAlign: nextAlign } );
} }
/>
</BlockControls>
<Block.div
className={ classnames( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ) }
>
{ display }
</Block.div>
</>
);
}