Skip to content
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,15 @@ function useMultiOriginColorPresets(
}

export function useHasFiltersPanel( settings ) {
const hasDuotone = useHasDuotoneControl( settings );

return hasDuotone;
return useHasDuotoneControl( settings );
}

function useHasDuotoneControl( settings ) {
return settings.color.customDuotone || settings.color.defaultDuotone;
return (
settings.color.customDuotone ||
settings.color.defaultDuotone ||
settings.color.duotone.length > 0
);
}

function FiltersToolsPanel( {
Expand Down Expand Up @@ -148,11 +150,6 @@ export default function FiltersPanel( {
const hasDuotone = () => !! value?.filter?.duotone;
const resetDuotone = () => setDuotone( undefined );

const disableCustomColors = ! settings?.color?.custom;
const disableCustomDuotone =
! settings?.color?.customDuotone ||
( colorPalette?.length === 0 && disableCustomColors );

const resetAllFilter = useCallback( ( previousValue ) => {
return {
...previousValue,
Expand Down Expand Up @@ -210,12 +207,9 @@ export default function FiltersPanel( {
<DuotonePicker
colorPalette={ colorPalette }
duotonePalette={ duotonePalette }
disableCustomColors={
disableCustomColors
}
disableCustomDuotone={
disableCustomDuotone
}
// TODO: Re-enable both when custom colors are supported for block-level styles.
disableCustomColors
disableCustomDuotone
value={ duotone }
onChange={ setDuotone }
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -283,13 +283,7 @@ function ScreenBlock( { name, variation } ) {
inheritedValue={ inheritedStyleWithLayout }
value={ styleWithLayout }
onChange={ setStyle }
settings={ {
...settings,
color: {
...settings.color,
customDuotone: false, //TO FIX: Custom duotone only works on the block level right now
},
} }
settings={ settings }
includeLayoutControls
/>
) }
Expand Down