diff --git a/packages/block-editor/src/components/global-styles/color-panel.js b/packages/block-editor/src/components/global-styles/color-panel.js index d222a07b0b59c..55c6dfbe4cc97 100644 --- a/packages/block-editor/src/components/global-styles/color-panel.js +++ b/packages/block-editor/src/components/global-styles/color-panel.js @@ -28,7 +28,7 @@ import { __, sprintf } from '@wordpress/i18n'; import ColorGradientControl from '../colors-gradients/control'; import { useColorsPerOrigin, useGradientsPerOrigin } from './hooks'; import { getValueFromVariable, TOOLSPANEL_DROPDOWNMENU_PROPS } from './utils'; -import { setImmutably, omit } from '../../utils/object'; +import { setImmutably } from '../../utils/object'; import { unlock } from '../../lock-unlock'; export function useHasColorPanel( settings ) { @@ -712,19 +712,22 @@ export default function ColorPanel( { onChange={ onChange } panelId={ panelId } > - { items.map( ( item ) => ( - - ) ) } + { items.map( ( item ) => { + const { key, ...restItem } = item; + return ( + + ); + } ) } { children } ); diff --git a/packages/block-editor/src/hooks/typography.js b/packages/block-editor/src/hooks/typography.js index a44d828d89b18..cf3f4327c8f03 100644 --- a/packages/block-editor/src/hooks/typography.js +++ b/packages/block-editor/src/hooks/typography.js @@ -20,7 +20,12 @@ import { FONT_SIZE_SUPPORT_KEY } from './font-size'; import { TEXT_ALIGN_SUPPORT_KEY } from './text-align'; import { cleanEmptyObject } from './utils'; import { store as blockEditorStore } from '../store'; -import { omit } from '../utils/object'; + +function omit( object, keys ) { + return Object.fromEntries( + Object.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) ) + ); +} const LETTER_SPACING_SUPPORT_KEY = 'typography.__experimentalLetterSpacing'; const TEXT_TRANSFORM_SUPPORT_KEY = 'typography.__experimentalTextTransform'; diff --git a/packages/block-editor/src/utils/object.js b/packages/block-editor/src/utils/object.js index a69735b8c685a..c78fe0e656dfe 100644 --- a/packages/block-editor/src/utils/object.js +++ b/packages/block-editor/src/utils/object.js @@ -65,17 +65,3 @@ export function uniqByProperty( array, property ) { return seen.has( value ) ? false : seen.add( value ); } ); } - -/** - * Helper to omit keys from a given object. - * - * @param {Object} object Object. - * @param {string[]} keys Keys to omit. - * - * @return {Object} Object without the omitted keys. - */ -export function omit( object, keys ) { - return Object.fromEntries( - Object.entries( object ).filter( ( [ key ] ) => ! keys.includes( key ) ) - ); -} diff --git a/packages/components/src/custom-select-control/index.js b/packages/components/src/custom-select-control/index.js index 24b3d8bdb9bd3..979aa0f7bdff8 100644 --- a/packages/components/src/custom-select-control/index.js +++ b/packages/components/src/custom-select-control/index.js @@ -185,7 +185,6 @@ export default function CustomSelectControl( props ) {