Skip to content

Commit

Permalink
Modified Date Block: Don't render change date tool (#57914)
Browse files Browse the repository at this point in the history
  • Loading branch information
t-hamano authored Jan 17, 2024
1 parent e7e343c commit aa9b374
Showing 1 changed file with 38 additions and 33 deletions.
71 changes: 38 additions & 33 deletions packages/block-library/src/post-date/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,40 +108,45 @@ export default function PostDateEdit( {
setAttributes( { textAlign: nextAlign } );
} }
/>
{ date && ! isDescendentOfQueryLoop && (
<ToolbarGroup>
<Dropdown
popoverProps={ popoverProps }
renderContent={ ( { onClose } ) => (
<PublishDateTimePicker
currentDate={ date }
onChange={ setDate }
is12Hour={ is12HourFormat(
siteTimeFormat
) }
onClose={ onClose }
/>
) }
renderToggle={ ( { isOpen, onToggle } ) => {
const openOnArrowDown = ( event ) => {
if ( ! isOpen && event.keyCode === DOWN ) {
event.preventDefault();
onToggle();
}
};
return (
<ToolbarButton
aria-expanded={ isOpen }
icon={ edit }
title={ __( 'Change Date' ) }
onClick={ onToggle }
onKeyDown={ openOnArrowDown }
{ date &&
displayType === 'date' &&
! isDescendentOfQueryLoop && (
<ToolbarGroup>
<Dropdown
popoverProps={ popoverProps }
renderContent={ ( { onClose } ) => (
<PublishDateTimePicker
currentDate={ date }
onChange={ setDate }
is12Hour={ is12HourFormat(
siteTimeFormat
) }
onClose={ onClose }
/>
);
} }
/>
</ToolbarGroup>
) }
) }
renderToggle={ ( { isOpen, onToggle } ) => {
const openOnArrowDown = ( event ) => {
if (
! isOpen &&
event.keyCode === DOWN
) {
event.preventDefault();
onToggle();
}
};
return (
<ToolbarButton
aria-expanded={ isOpen }
icon={ edit }
title={ __( 'Change Date' ) }
onClick={ onToggle }
onKeyDown={ openOnArrowDown }
/>
);
} }
/>
</ToolbarGroup>
) }
</BlockControls>

<InspectorControls>
Expand Down

0 comments on commit aa9b374

Please sign in to comment.