Skip to content

Commit

Permalink
Remove code which moves text alignment control to the block toolbar
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Jun 14, 2019
1 parent 02020b2 commit 2f0a325
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 15 deletions.
13 changes: 7 additions & 6 deletions packages/block-library/src/heading/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,18 @@ function HeadingEdit( {
<>
<BlockControls>
<HeadingToolbar minLevel={ 2 } maxLevel={ 5 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />
<AlignmentToolbar
value={ align }
onChange={ ( nextAlign ) => {
setAttributes( { align: nextAlign } );
} }
/>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Heading Settings' ) }>
<p>{ __( 'Level' ) }</p>
<HeadingToolbar minLevel={ 1 } maxLevel={ 7 } selectedLevel={ level } onChange={ ( newLevel ) => setAttributes( { level: newLevel } ) } />
<p>{ __( 'Text Alignment' ) }</p>
<AlignmentToolbar
value={ align }
onChange={ ( nextAlign ) => {
setAttributes( { align: nextAlign } );
} }
/>
</PanelBody>
<HeadingColorUI
setTextColor={ setTextColor }
Expand Down
12 changes: 3 additions & 9 deletions packages/block-library/src/heading/heading-toolbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import { range } from 'lodash';
import { __, sprintf } from '@wordpress/i18n';
import { Component } from '@wordpress/element';
import { Toolbar } from '@wordpress/components';
import { withViewportMatch } from '@wordpress/viewport';

class HeadingToolbar extends Component {
createLevelControl( targetLevel, selectedLevel, onChange ) {
Expand All @@ -24,16 +23,11 @@ class HeadingToolbar extends Component {
}

render() {
const { isLargeViewport, minLevel, maxLevel, onChange, selectedLevel } = this.props;
const { minLevel, maxLevel, selectedLevel, onChange } = this.props;
return (
<Toolbar
controls={ range( minLevel, maxLevel ).map( ( index ) => this.createLevelControl( index, selectedLevel, onChange ) ) }
icon="heading"
isCollapsed={ ! isLargeViewport }
label={ __( 'Change level' ) }
/>
<Toolbar controls={ range( minLevel, maxLevel ).map( ( index ) => this.createLevelControl( index, selectedLevel, onChange ) ) } />
);
}
}

export default withViewportMatch( { isLargeViewport: 'medium' } )( HeadingToolbar );
export default HeadingToolbar;

0 comments on commit 2f0a325

Please sign in to comment.