-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hide color pickers in paragraph and button if no colors are available.
If the theme sets the colors palette to empty and disable custom colors, the color picker mechanism did not work correctly. It just showed a non-functional back color to choose from. Now we hide the color picker mechanism as in that case it is not possible to choose colors.
- Loading branch information
1 parent
37ccb55
commit 13fc90d
Showing
3 changed files
with
35 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { isEmpty } from 'lodash'; | ||
|
||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ifCondition, PanelColor, withContext } from '@wordpress/components'; | ||
import { compose } from '@wordpress/element'; | ||
|
||
export default compose( | ||
withContext( 'editor' )( | ||
( settings, props ) => ( { | ||
colors: props.colors || settings.colors, | ||
disableCustomColors: props.disableCustomColors !== undefined ? | ||
props.disableCustomColors : | ||
settings.disableCustomColors, | ||
} ) | ||
), | ||
ifCondition( | ||
( { colors, disableCustomColors } ) => ! ( isEmpty( colors ) && disableCustomColors ) | ||
) | ||
)( PanelColor ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters