Skip to content

Commit

Permalink
Refactor PositionControlsPanel to clean up empty style properties f…
Browse files Browse the repository at this point in the history
…or selected blocks
  • Loading branch information
yogeshbhutkar committed Jan 21, 2025
1 parent cf9871e commit 5b17dea
Showing 1 changed file with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import InspectorControlsGroups from '../inspector-controls/groups';
import { default as InspectorControls } from '../inspector-controls';
import { store as blockEditorStore } from '../../store';
import { useToolsPanelDropdownMenuProps } from '../global-styles/utils';
import { cleanEmptyObject } from '../../hooks/utils';

const PositionControlsPanel = () => {
const { selectedClientIds, selectedBlocks, hasPositionAttribute } =
Expand Down Expand Up @@ -49,10 +50,17 @@ const PositionControlsPanel = () => {
selectedBlocks?.map( ( { clientId, attributes } ) => [
clientId,
{
style: {
style: cleanEmptyObject( {
...attributes?.style,
position: undefined,
},
position: {
...attributes?.style?.position,
type: undefined,
top: undefined,
right: undefined,
bottom: undefined,
left: undefined,
},
} ),
},
] )
);
Expand Down

0 comments on commit 5b17dea

Please sign in to comment.