Skip to content

Commit

Permalink
Add alignment controls to toolbar WordPress#3785
Browse files Browse the repository at this point in the history
  • Loading branch information
amdrew committed Mar 15, 2018
1 parent 1e87758 commit f5d5596
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions blocks/library/heading/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ export const settings = {
edit( { attributes, setAttributes, isSelected, mergeBlocks, insertBlocksAfter, onReplace } ) {
const { align, content, nodeName, placeholder } = attributes;

const alignmentToolbar = (
<AlignmentToolbar
value={ align }
onChange={ ( nextAlign ) => {
setAttributes( { align: nextAlign } );
} }
/>
);

return [
isSelected && (
<BlockControls
Expand All @@ -117,7 +126,9 @@ export const settings = {
subscript: level,
} ) )
}
/>
>
{ alignmentToolbar }
</BlockControls>
),
isSelected && (
<InspectorControls key="inspector">
Expand All @@ -135,12 +146,7 @@ export const settings = {
}
/>
<p>{ __( 'Text Alignment' ) }</p>
<AlignmentToolbar
value={ align }
onChange={ ( nextAlign ) => {
setAttributes( { align: nextAlign } );
} }
/>
{ alignmentToolbar }
</InspectorControls>
),
<RichText
Expand Down

0 comments on commit f5d5596

Please sign in to comment.