diff --git a/packages/block-editor/src/components/font-family/index.js b/packages/block-editor/src/components/font-family/index.js index 8d49de5bf0b168..08e17313368a61 100644 --- a/packages/block-editor/src/components/font-family/index.js +++ b/packages/block-editor/src/components/font-family/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -25,7 +20,7 @@ export default function FontFamilyControl( { fontFamilies = blockLevelFontFamilies; } - if ( isEmpty( fontFamilies ) ) { + if ( ! fontFamilies || fontFamilies.length === 0 ) { return null; } diff --git a/packages/block-editor/src/components/image-size-control/index.js b/packages/block-editor/src/components/image-size-control/index.js index b8c2d656070558..c6dfe3880e70a8 100644 --- a/packages/block-editor/src/components/image-size-control/index.js +++ b/packages/block-editor/src/components/image-size-control/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -39,7 +34,7 @@ export default function ImageSizeControl( { return ( <> - { ! isEmpty( imageSizeOptions ) && ( + { imageSizeOptions && imageSizeOptions.length > 0 && ( 0 || filteredBlockPatterns.length > 0; const blocksUI = !! filteredBlockTypes.length && ( !! value ) ); + return Object.values( values ).filter( ( value ) => !! value ).length > 0; } diff --git a/packages/block-library/src/heading/index.js b/packages/block-library/src/heading/index.js index 56bf1f670e92db..4ff1203df33fcc 100644 --- a/packages/block-library/src/heading/index.js +++ b/packages/block-library/src/heading/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -41,7 +36,7 @@ export const settings = { } if ( context === 'accessibility' ) { - return isEmpty( content ) + return ! content || content.length === 0 ? sprintf( /* translators: accessibility text. %s: heading level. */ __( 'Level %s. Empty.' ), diff --git a/packages/block-library/src/paragraph/index.js b/packages/block-library/src/paragraph/index.js index c9a00ccf4b33f0..bceff881367074 100644 --- a/packages/block-library/src/paragraph/index.js +++ b/packages/block-library/src/paragraph/index.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { isEmpty } from 'lodash'; - /** * WordPress dependencies */ @@ -35,7 +30,7 @@ export const settings = { __experimentalLabel( attributes, { context } ) { if ( context === 'accessibility' ) { const { content } = attributes; - return isEmpty( content ) ? __( 'Empty' ) : content; + return ! content || content.length === 0 ? __( 'Empty' ) : content; } }, transforms,