Skip to content

Commit

Permalink
Restore packages/block-library/src/post-title/edit.js from trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
noisysocks committed May 23, 2023
1 parent 3d437a4 commit 25f3e58
Showing 1 changed file with 14 additions and 21 deletions.
35 changes: 14 additions & 21 deletions packages/block-library/src/post-title/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import {
InspectorControls,
useBlockProps,
PlainText,
privateApis as blockEditorPrivateApis,
} from '@wordpress/block-editor';
import { ToggleControl, TextControl, PanelBody } from '@wordpress/components';
import { __ } from '@wordpress/i18n';
Expand All @@ -24,9 +23,6 @@ import { useEntityProp } from '@wordpress/core-data';
*/
import HeadingLevelDropdown from '../heading/heading-level-dropdown';
import { useCanEditEntity } from '../utils/hooks';
import { unlock } from '../private-apis';

const { useBlockEditingMode } = unlock( blockEditorPrivateApis );

export default function PostTitleEdit( {
attributes: { level, textAlign, isLink, rel, linkTarget },
Expand Down Expand Up @@ -62,7 +58,6 @@ export default function PostTitleEdit( {
[ `has-text-align-${ textAlign }` ]: textAlign,
} ),
} );
const blockEditingMode = useBlockEditingMode();

let titleElement = (
<TagName { ...blockProps }>{ __( 'Post Title' ) }</TagName>
Expand Down Expand Up @@ -119,22 +114,20 @@ export default function PostTitleEdit( {

return (
<>
{ blockEditingMode === 'default' && (
<BlockControls group="block">
<HeadingLevelDropdown
selectedLevel={ level }
onChange={ ( newLevel ) =>
setAttributes( { level: newLevel } )
}
/>
<AlignmentControl
value={ textAlign }
onChange={ ( nextAlign ) => {
setAttributes( { textAlign: nextAlign } );
} }
/>
</BlockControls>
) }
<BlockControls group="block">
<HeadingLevelDropdown
selectedLevel={ level }
onChange={ ( newLevel ) =>
setAttributes( { level: newLevel } )
}
/>
<AlignmentControl
value={ textAlign }
onChange={ ( nextAlign ) => {
setAttributes( { textAlign: nextAlign } );
} }
/>
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<ToggleControl
Expand Down

0 comments on commit 25f3e58

Please sign in to comment.