Skip to content

Commit

Permalink
Move block props to the outer wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
Glen Davies committed Dec 13, 2020
1 parent 072ce27 commit e0723a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions packages/block-library/src/image/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,7 @@ export function ImageEdit( {
'is-resized': !! width || !! height,
'is-focused': isSelected,
[ `size-${ sizeSlug }` ]: sizeSlug,
'list-image': isListItem,
} );

const blockProps = useBlockProps( {
Expand All @@ -333,8 +334,8 @@ export function ImageEdit( {
return (
<>
{ controls }
<li className="list-image">
<figure { ...blockProps }>
<li { ...blockProps }>
<figure>
{ image }
{ mediaPlaceholder }
</figure>
Expand Down
5 changes: 3 additions & 2 deletions packages/block-library/src/image/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function save( { attributes } ) {
[ `align${ align }` ]: align,
[ `size-${ sizeSlug }` ]: sizeSlug,
'is-resized': width || height,
'list-image': isListItem,
} );

const image = (
Expand Down Expand Up @@ -69,8 +70,8 @@ export default function save( { attributes } ) {
const blockProps = useBlockProps.save( { className: classes } );
if ( isListItem ) {
return (
<li className="list-image">
<figure { ...blockProps }>{ figure }</figure>
<li { ...blockProps }>
<figure>{ figure }</figure>
</li>
);
}
Expand Down

0 comments on commit e0723a7

Please sign in to comment.