Skip to content

Commit

Permalink
Podcast Player: Fix missing replace button (#15508)
Browse files Browse the repository at this point in the history
* Podcast Player: Fix missing replace button

* Add fallback for pre-5.4 WP installs

Props @jeherve

Co-authored-by: Konstantin Obenland <[email protected]>
  • Loading branch information
frontdevde and obenland authored Apr 23, 2020
1 parent fda0d83 commit c9b52ff
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions extensions/blocks/podcast-player/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
RangeControl,
TextControl,
Toolbar,
ToolbarGroup,
withNotices,
ToggleControl,
Spinner,
Expand Down Expand Up @@ -235,16 +236,6 @@ const PodcastPlayerEdit = ( {
);
}

const toolbarControls = [
{
title: __( 'Edit Podcast Feed URL', 'jetpack' ),
onClick: () => setIsEditing( true ),
extraProps: {
children: __( 'Replace', 'jetpack' ),
},
},
];

// Loading state for fetching the feed.
if ( ! feedData.tracks || ! feedData.tracks.length ) {
return (
Expand All @@ -266,7 +257,29 @@ const PodcastPlayerEdit = ( {
return (
<>
<BlockControls>
<Toolbar controls={ toolbarControls } />
{ /* @todo Fallback can be removed when WP 5.4 is the minimum supported version. */ }
{ ToolbarGroup ? (
<ToolbarGroup>
<Button
aria-label={ __( 'Edit Podcast Feed URL', 'jetpack' ) }
onClick={ () => setIsEditing( true ) }
>
{ __( 'Replace', 'jetpack' ) }
</Button>
</ToolbarGroup>
) : (
<Toolbar
controls={ [
{
title: __( 'Edit Podcast Feed URL', 'jetpack' ),
onClick: () => setIsEditing( true ),
extraProps: {
children: __( 'Replace', 'jetpack' ),
},
},
] }
/>
) }
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Podcast settings', 'jetpack' ) }>
Expand Down

0 comments on commit c9b52ff

Please sign in to comment.