Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Check for FocalPointPicker before using it (compat for WP 5.1)
Browse files Browse the repository at this point in the history
  • Loading branch information
ryelle committed Apr 30, 2019
1 parent fd41a32 commit 0e19076
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions assets/js/blocks/featured-product/block.js
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ class FeaturedProduct extends Component {

const url =
attributes.mediaSrc || getImageSrcFromProduct( this.state.product );
const { focalPoint = { x: 0.5, y: 0.5 } } = attributes;

return (
<InspectorControls key="inspector">
Expand Down Expand Up @@ -160,11 +161,11 @@ class FeaturedProduct extends Component {
max={ 100 }
step={ 10 }
/>
{ url &&
{ !! FocalPointPicker && !! url &&
<FocalPointPicker
label={ __( 'Focal Point Picker' ) }
url={ url }
value={ attributes.focalPoint }
value={ focalPoint }
onChange={ ( value ) => setAttributes( { focalPoint: value } ) }
/>
}
Expand Down

0 comments on commit 0e19076

Please sign in to comment.