Skip to content

Commit

Permalink
Lodash: Remove from Media & Text block (#50587)
Browse files Browse the repository at this point in the history
  • Loading branch information
tyxla committed May 12, 2023
1 parent 831a536 commit 298df3a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
9 changes: 4 additions & 5 deletions packages/block-library/src/media-text/deprecated.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import classnames from 'classnames';
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -258,7 +257,7 @@ const v6 = {
} = attributes;
const mediaSizeSlug =
attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = isEmpty( rel ) ? undefined : rel;
const newRel = ! rel ? undefined : rel;

const imageClasses = classnames( {
[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',
Expand Down Expand Up @@ -387,7 +386,7 @@ const v5 = {
} = attributes;
const mediaSizeSlug =
attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = isEmpty( rel ) ? undefined : rel;
const newRel = ! rel ? undefined : rel;

const imageClasses = classnames( {
[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',
Expand Down Expand Up @@ -501,7 +500,7 @@ const v4 = {
} = attributes;
const mediaSizeSlug =
attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = isEmpty( rel ) ? undefined : rel;
const newRel = ! rel ? undefined : rel;

const imageClasses = classnames( {
[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',
Expand Down Expand Up @@ -646,7 +645,7 @@ const v3 = {
linkTarget,
rel,
} = attributes;
const newRel = isEmpty( rel ) ? undefined : rel;
const newRel = ! rel ? undefined : rel;

let image = (
<img
Expand Down
3 changes: 1 addition & 2 deletions packages/block-library/src/media-text/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* External dependencies
*/
import classnames from 'classnames';
import { isEmpty } from 'lodash';

/**
* WordPress dependencies
Expand Down Expand Up @@ -36,7 +35,7 @@ export default function save( { attributes } ) {
rel,
} = attributes;
const mediaSizeSlug = attributes.mediaSizeSlug || DEFAULT_MEDIA_SIZE_SLUG;
const newRel = isEmpty( rel ) ? undefined : rel;
const newRel = ! rel ? undefined : rel;

const imageClasses = classnames( {
[ `wp-image-${ mediaId }` ]: mediaId && mediaType === 'image',
Expand Down

0 comments on commit 298df3a

Please sign in to comment.