Skip to content
Open
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
25 changes: 14 additions & 11 deletions src/plugins/global-settings/color-schemes/color-scheme-picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -236,22 +236,25 @@ const ColorSchemePicker = props => {
}
}

const currentItem = cloneDeep( itemInEdit )
setItemInEdit( prevItem => {
// clone deep causes the color picker to jump when dragging, so we use a spread operator to create a new object
const currentItem = { ...prevItem }

if ( ! schemeHasValue( currentItem.colorScheme ) && changeDefaultName ) {
currentItem.name = currentItem?.key === 'scheme-default-1' ? 'Color Scheme 1' : 'Color Scheme 2'
}
if ( ! schemeHasValue( currentItem.colorScheme ) && changeDefaultName ) {
currentItem.name = currentItem?.key === 'scheme-default-1' ? 'Color Scheme 1' : 'Color Scheme 2'
}

currentItem.colorScheme[ property ][ currentState ] = color
currentItem.colorScheme[ property ][ currentState ] = color

if ( property === 'backgroundColor' && isGradient( color ) ) {
currentItem.colorScheme[ property ].desktopHover = ''
currentItem.colorScheme[ property ].desktopParentHover = ''
}
if ( property === 'backgroundColor' && isGradient( color ) ) {
currentItem.colorScheme[ property ].desktopHover = ''
currentItem.colorScheme[ property ].desktopParentHover = ''
}

setItemInEdit( currentItem )
updateColorSchemes( currentItem )

updateColorSchemes( currentItem )
return currentItem
} )
}

// For updating option to show the color scheme in color pickers
Expand Down
Loading