diff --git a/.eslintrc.js b/.eslintrc.js index 46c930ee0fb73..341c9d0a7dd85 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -115,6 +115,7 @@ const restrictedImports = [ 'partial', 'partialRight', 'pick', + 'pickBy', 'random', 'reduce', 'reject', diff --git a/packages/block-editor/src/components/font-sizes/with-font-sizes.js b/packages/block-editor/src/components/font-sizes/with-font-sizes.js index 380ea5a3dc0c5..50f3ea7782817 100644 --- a/packages/block-editor/src/components/font-sizes/with-font-sizes.js +++ b/packages/block-editor/src/components/font-sizes/with-font-sizes.js @@ -1,8 +1,3 @@ -/** - * External dependencies - */ -import { pickBy } from 'lodash'; - /** * WordPress dependencies */ @@ -160,35 +155,40 @@ export default ( ...fontSizeNames ) => { } const newState = Object.entries( - pickBy( - fontSizeAttributeNames, - didAttributesChange + fontSizeAttributeNames + ) + .filter( ( [ key, value ] ) => + didAttributesChange( value, key ) ) - ).reduce( - ( - newStateAccumulator, - [ - fontSizeAttributeName, - customFontSizeAttributeName, - ] - ) => { - const fontSizeAttributeValue = - attributes[ fontSizeAttributeName ]; - const fontSizeObject = getFontSize( - fontSizes, - fontSizeAttributeValue, - attributes[ customFontSizeAttributeName ] - ); - newStateAccumulator[ fontSizeAttributeName ] = { - ...fontSizeObject, - class: getFontSizeClass( - fontSizeAttributeValue - ), - }; - return newStateAccumulator; - }, - {} - ); + .reduce( + ( + newStateAccumulator, + [ + fontSizeAttributeName, + customFontSizeAttributeName, + ] + ) => { + const fontSizeAttributeValue = + attributes[ fontSizeAttributeName ]; + const fontSizeObject = getFontSize( + fontSizes, + fontSizeAttributeValue, + attributes[ + customFontSizeAttributeName + ] + ); + newStateAccumulator[ + fontSizeAttributeName + ] = { + ...fontSizeObject, + class: getFontSizeClass( + fontSizeAttributeValue + ), + }; + return newStateAccumulator; + }, + {} + ); return { ...previousState,