Skip to content

Commit 3e0aae6

Browse files
committed
Pass props down instead
1 parent 180ba21 commit 3e0aae6

File tree

2 files changed

+8
-11
lines changed

2 files changed

+8
-11
lines changed

packages/block-library/src/paragraph/controls.js

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,8 @@ import {
1212
BlockControls,
1313
InspectorControls,
1414
useSettings,
15-
store as blockEditorStore,
1615
} from '@wordpress/block-editor';
1716
import { formatLtr } from '@wordpress/icons';
18-
import { useSelect } from '@wordpress/data';
1917
import { pure } from '@wordpress/compose';
2018

2119
function ParagraphRTLControl( { direction, setDirection } ) {
@@ -37,16 +35,9 @@ export function hasDropCapDisabled( align ) {
3735
return align === ( isRTL() ? 'left' : 'right' ) || align === 'center';
3836
}
3937

40-
function Controls( { clientId, setAttributes } ) {
38+
function Controls( { align, direction, dropCap, clientId, setAttributes } ) {
4139
const [ isDropCapFeatureEnabled ] = useSettings( 'typography.dropCap' );
4240

43-
function selector( select ) {
44-
const { align, direction, dropCap } =
45-
select( blockEditorStore ).getBlockAttributes( clientId ) || {};
46-
return { align, direction, dropCap };
47-
}
48-
const { align, direction, dropCap } = useSelect( selector, [ clientId ] );
49-
5041
let helpText;
5142
if ( hasDropCapDisabled( align ) ) {
5243
helpText = __( 'Not available for aligned text.' );

packages/block-library/src/paragraph/edit.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,13 @@ function ParagraphBlock( {
3737

3838
return (
3939
<>
40-
<Controls clientId={ clientId } setAttributes={ setAttributes } />
40+
<Controls
41+
align={ align }
42+
direction={ direction }
43+
dropCap={ dropCap }
44+
clientId={ clientId }
45+
setAttributes={ setAttributes }
46+
/>
4147
<RichText
4248
identifier="content"
4349
tagName="p"

0 commit comments

Comments
 (0)