Skip to content

Commit 81b97ff

Browse files
committed
block styles
1 parent 9de8c0c commit 81b97ff

File tree

1 file changed

+11
-3
lines changed
  • src/components/block-styles-control

1 file changed

+11
-3
lines changed

src/components/block-styles-control/index.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,8 @@ export const BlockStylesControl = props => {
221221
} else {
222222
setOpenProNotice( value => ! value )
223223
}
224+
225+
setOpenPopover( false )
224226
}
225227

226228
const SaveUpdateModal = applyFilters( 'stackable.global-settings.global-block-styles.save-update-modal', Fragment )
@@ -233,11 +235,13 @@ export const BlockStylesControl = props => {
233235
>
234236
<Button
235237
variant="tertiary"
236-
className="ugb-block-styles-controls__block-style-button"
238+
className={ classnames( 'ugb-block-styles-controls__block-style-button', {
239+
'is-opened': openPopover,
240+
} ) }
237241
size="small"
238242
icon="edit"
239243
iconSize={ 12 }
240-
onMouseDown={ () => setOpenPopover( isOpen => ! isOpen ) }
244+
onClick={ () => setOpenPopover( isOpen => ! isOpen ) }
241245
ref={ buttonRef }
242246
>
243247
{ `${ __( 'Block Style', i18n ) }:` } <wbr /> { blockStyleLabel }{ isModified && inBlockStyleOptions ? <span className="stk-panel-modified-indicator stk--visible"></span> : '' }
@@ -267,7 +271,6 @@ export const BlockStylesControl = props => {
267271
className="ugb-button-icon-control__popover ugb-block-styles-controls__popover"
268272
anchor={ buttonRef.current }
269273
onEscape={ () => setOpenPopover( false ) }
270-
onClose={ () => setOpenPopover( false ) }
271274
focusOnMount={ false }
272275
placement="left-start"
273276
resize={ false }
@@ -297,6 +300,8 @@ export const BlockStylesControl = props => {
297300
onClick={ () => onSelectBlockStyle( option.slug, index + 1 ) }
298301
className={ blockStyle === option.slug ? 'ugb-block-styles-controls__selected' : '' }
299302
tabIndex={ 0 }
303+
data-slug={ option.slug }
304+
data-name={ option.name }
300305
>
301306
{ blockStyle === option.slug && <span className="ugb-block-styles-controls__selected-icon"> <Dashicon icon="saved" /> </span> }
302307
<span className="ugb-block-styles-controls__label">
@@ -313,6 +318,7 @@ export const BlockStylesControl = props => {
313318
blockStyle={ blockStyle }
314319
inOptions={ inBlockStyleOptions }
315320
isModified={ isModified }
321+
buttonClassName={ `${ openSaveModal ? 'is-opened' : '' }` }
316322
setOpenSaveModal={ setOpenSaveModal }
317323
onAddBlockStyle={ onAddBlockStyle }
318324
/>
@@ -347,6 +353,8 @@ const SaveUpdateButtons = props => {
347353
variant="primary"
348354
onClick={ () => onAddBlockStyle() }
349355
size="small"
356+
data-action="save-style"
357+
className={ props.buttonClassName }
350358
>
351359
{ __( 'Save New Block Style', i18n ) }
352360
{ ! isPro && <span className="stk-pulsating-circle" role="presentation" /> }

0 commit comments

Comments
 (0)