File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
src/components/block-styles-control Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -63,9 +63,9 @@ export const BlockStylesControl = props => {
6363 const globalBlockStyles = select ( 'stackable/global-block-styles' ) . getBlockStyles ( blockName )
6464
6565 const invalidNames = globalBlockStyles . reduce ( ( output , item ) => {
66- output [ item . name . toLowerCase ( ) ] = 1
66+ output . add ( item . name . toLowerCase ( ) )
6767 return output
68- } , { } )
68+ } , new Set ( ) )
6969
7070 const blockStyleOptions = globalBlockStyles . reduce ( ( options , blockStyle ) => {
7171 options . push ( { label : blockStyle . name , value : blockStyle . slug } )
@@ -157,12 +157,13 @@ export const BlockStylesControl = props => {
157157 value = { isModified }
158158 default = { false }
159159 onChange = { ( ) => {
160- if ( ! blockStyle ) {
160+ const blockStyleAttrs = globalBlockStyles . find ( item => item . slug === blockStyle ) ?. attributes
161+
162+ if ( ! blockStyle || blockStyleAttrs === undefined ) {
161163 setAttributes ( defaultBlockAttributes )
162164 return
163165 }
164166
165- const blockStyleAttrs = globalBlockStyles . find ( item => item . slug === blockStyle ) . attributes
166167 setAttributes ( {
167168 ...defaultBlockAttributes ,
168169 ...blockStyleAttrs ,
You can’t perform that action at this time.
0 commit comments