Skip to content

Commit 9f00744

Browse files
committed
Wrap the always-visible textControl in a PanelBody so that it has the right padding, etc
1 parent ee341bd commit 9f00744

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

js/block.js

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
* Text tools
2121
*/
2222
var TextControl = wp.components.TextControl;
23+
var PanelBody = wp.components.PanelBody;
2324

2425
/**
2526
* The sidebar controls I think?
@@ -121,20 +122,19 @@
121122
onChange: ( value ) => { props.setAttributes( { src: value } ); },
122123
} )
123124
),
124-
/*
125-
* InspectorControls lets you add controls to the Block sidebar. In this case,
126-
* we're adding a TextControl, which lets us edit the 'foo' attribute (which
127-
* we defined in the PHP). The onChange property is a little bit of magic to tell
128-
* the block editor to update the value of our 'foo' property, and to re-render
129-
* the block.
130-
*/
131125
el( InspectorControls, {},
132-
el( TextControl, {
133-
label: __( 'Pym.js Child URL' ),
134-
value: props.attributes.src,
135-
placeholder: __( 'What is the URL of your Pym.js child page?' ),
136-
onChange: ( value ) => { props.setAttributes( { src: value } ); },
137-
} ),
126+
el(
127+
PanelBody, // inserting a PanelBody here for the presentational classes, so that it matches the display of InspectorAdvancedControls children
128+
{
129+
initialOpen: true,
130+
},
131+
el( TextControl, {
132+
label: __( 'Pym.js Child URL' ),
133+
value: props.attributes.src,
134+
placeholder: __( 'What is the URL of your Pym.js child page?' ),
135+
onChange: ( value ) => { props.setAttributes( { src: value } ); },
136+
} )
137+
)
138138
),
139139
el( InspectorAdvancedControls, {},
140140
el( TextControl, {

0 commit comments

Comments
 (0)