Skip to content

Commit

Permalink
Add check to make sure getSpacingClassesAndStyles() exists
Browse files Browse the repository at this point in the history
The commit adds check that looks if `getSpacingClassesAndStyles()` exists.

If it does not exist, `getStyles()` will return an empty object.
  • Loading branch information
ivan-ottinger committed Jan 21, 2022
1 parent 084d95b commit e367e3d
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const handleLinkClick = event => {
};

const getStyles = ( attributes = {} ) => {
const spacingProps = getSpacingClassesAndStyles( attributes );
return spacingProps.style;
const spacingProps = getSpacingClassesAndStyles?.( attributes );
return spacingProps?.style ? spacingProps.style : {};
};

export default ( { className, source = '', attributes } ) => (
Expand Down

0 comments on commit e367e3d

Please sign in to comment.