@@ -6,7 +6,9 @@ import PRESET_COLOR_SCHEMES from './preset-color-schemes.json'
66/**
77 * External dependencies
88 */
9- import { i18n , isPro } from 'stackable'
9+ import {
10+ i18n , isPro , showProNotice ,
11+ } from 'stackable'
1012import {
1113 SortablePicker ,
1214 InspectorSubHeader ,
@@ -16,6 +18,8 @@ import {
1618 ColorSchemePresetPicker ,
1719 DEFAULT_COLOR_SCHEME_COLORS ,
1820 AdvancedToggleControl ,
21+ ProControlButton ,
22+ ControlSeparator ,
1923} from '~stackable/components'
2024import { useBlockHoverState } from '~stackable/hooks'
2125import { extractColor } from '~stackable/util'
@@ -92,9 +96,10 @@ const ColorSchemePicker = props => {
9296 }
9397 } )
9498
99+ const presets = applyFilters ( 'stackable.global-settings.global-color-schemes.presets' , PRESETS )
100+
95101 const [ subHeaderControls , setSubHeaderControls ] = useState ( { showTrash : false , showReset : false } )
96- const [ currentHoverState , _ , hasParentHoverState ] = useBlockHoverState ( { forceUpdateHoverState : true } )
97- const clientIds = useSelect ( select => select ( 'core/block-editor' ) . getSelectedBlockClientIds ( ) )
102+ const [ currentHoverState ] = useBlockHoverState ( { forceUpdateHoverState : true } )
98103
99104 const currentState = `desktop${ hoverState [ currentHoverState ] } `
100105
@@ -115,12 +120,6 @@ const ColorSchemePicker = props => {
115120 setSubHeaderControls ( controls )
116121 } , [ itemInEdit ] )
117122
118- useEffect ( ( ) => {
119- if ( clientIds . length > 0 && ! hasParentHoverState && currentHoverState === 'parent-hover' ) {
120- dispatch ( 'stackable/hover-state' ) . updateHoverState ( 'normal' )
121- }
122- } , [ hasParentHoverState ] )
123-
124123 // Get the custom color schemes
125124 const customColorSchemes = applyFilters ( 'stackable.global-settings.global-color-schemes.custom-color-schemes' , [ ] )
126125
@@ -348,14 +347,6 @@ const ColorSchemePicker = props => {
348347 return [ 'normal' , 'hover' , 'parent-hover' ]
349348 }
350349
351- const getDisabledHoverOptions = ( ) => {
352- if ( clientIds . length > 0 && ! hasParentHoverState ) {
353- return [ 'parent-hover' ]
354- }
355-
356- return [ ]
357- }
358-
359350 const getToggleProps = settings => {
360351 const disabled = isDisabled ( settings . property )
361352 const gradient = isGradient ( itemInEdit ?. colorScheme [ settings . property ] ?. desktop )
@@ -418,9 +409,12 @@ const ColorSchemePicker = props => {
418409
419410 < ColorSchemePresetPicker
420411 label = { __ ( 'Color Scheme Presets' , i18n ) }
421- presets = { PRESETS }
412+ presets = { presets }
422413 onPresetClick = { onPresetClick }
423414 />
415+ { showProNotice && < ProControlButton type = "color-schemes" /> }
416+ < ControlSeparator />
417+
424418 < AdvancedToggleControl
425419 label = { __ ( 'Show Scheme Colors in Color Pickers' , i18n ) }
426420 checked = { ! itemInEdit ?. hideInPicker }
@@ -442,7 +436,6 @@ const ColorSchemePicker = props => {
442436 enableGradient = { currentHoverState === 'normal' || settings . property === 'buttonBackgroundColor' }
443437 additionalToggleProps = { getToggleProps ( settings ) }
444438 allowReset = { ! isDisabled ( settings . property ) }
445- disabledHoverOptions = { getDisabledHoverOptions ( ) }
446439 />
447440 ) ) }
448441 </ >
0 commit comments