Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions packages/block-editor/src/hooks/effects.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import StylesEffectsPanel, {
} from '../components/global-styles/effects-panel';
import { InspectorControls } from '../components';
import { store as blockEditorStore } from '../store';
import { cleanEmptyObject } from './utils';

export const SHADOW_SUPPORT_KEY = 'shadow';
export const EFFECTS_SUPPORT_KEYS = [ SHADOW_SUPPORT_KEY ];
Expand All @@ -30,17 +31,14 @@ function EffectsInspectorControl( { children, resetAllFilter } ) {
}
export function EffectsPanel( { clientId, setAttributes, settings } ) {
const isEnabled = useHasEffectsPanel( settings );
const blockAttributes = useSelect(
( select ) => select( blockEditorStore ).getBlockAttributes( clientId ),
const value = useSelect(
( select ) =>
select( blockEditorStore ).getBlockAttributes( clientId )?.style,
[ clientId ]
);
const shadow = blockAttributes?.style?.shadow;
const value = { shadow };

const onChange = ( newValue ) => {
setAttributes( {
style: { ...blockAttributes.style, shadow: newValue.shadow },
} );
const onChange = ( newStyle ) => {
setAttributes( { style: cleanEmptyObject( newStyle ) } );
};

if ( ! isEnabled ) {
Expand Down