Skip to content

Commit

Permalink
Restore original conditional statement
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano committed Aug 23, 2024
1 parent 0d2f566 commit 163f319
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 20 deletions.
43 changes: 24 additions & 19 deletions packages/block-library/src/template-part/edit/advanced-controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const htmlElementMessages = {
export function TemplatePartAdvancedControls( {
tagName,
setAttributes,
isEntityAvailable,
templatePartId,
defaultWrapper,
hasInnerBlocks,
Expand Down Expand Up @@ -69,25 +70,29 @@ export function TemplatePartAdvancedControls( {

return (
<>
<TextControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Title' ) }
value={ title }
onChange={ ( value ) => {
setTitle( value );
} }
onFocus={ ( event ) => event.target.select() }
/>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Area' ) }
labelPosition="top"
options={ areaOptions }
value={ area }
onChange={ setArea }
/>
{ isEntityAvailable && (
<>
<TextControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Title' ) }
value={ title }
onChange={ ( value ) => {
setTitle( value );
} }
onFocus={ ( event ) => event.target.select() }
/>
<SelectControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Area' ) }
labelPosition="top"
options={ areaOptions }
value={ area }
onChange={ setArea }
/>
</>
) }
<SelectControl
__nextHasNoMarginBottom
__next40pxDefaultSize
Expand Down
3 changes: 2 additions & 1 deletion packages/block-library/src/template-part/edit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -254,11 +254,12 @@ export default function TemplatePartEdit( {
</ToolbarButton>
</BlockControls>
) }
{ isEntityAvailable && canUserEdit && (
{ canUserEdit && (
<InspectorControls group="advanced">
<TemplatePartAdvancedControls
tagName={ tagName }
setAttributes={ setAttributes }
isEntityAvailable={ isEntityAvailable }
templatePartId={ templatePartId }
defaultWrapper={ areaObject.tagName }
hasInnerBlocks={ hasInnerBlocks }
Expand Down

0 comments on commit 163f319

Please sign in to comment.