Skip to content

Commit

Permalink
BUGFIX: Error when selecting preset
Browse files Browse the repository at this point in the history
Resolves: #75
  • Loading branch information
Sebobo committed Jan 10, 2023
1 parent 2ba59ee commit 63800fd
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ export default function makeColorPickerEditor(defaults: ColorPickerOptions) {

handleChangeColor = (newColor) => {
const { commit, options } = this.props;
const { presetColors } = this.state;

switch (options.mode) {
// In the mode "preset", the value to be stored might can be defined in the color definition value
case 'preset': {
const matchingPreset = this.presetColors.find((preset) => preset.color === newColor.hex);
const matchingPreset = presetColors.find((preset) => preset.color === newColor.hex);
if (matchingPreset) {
commit(matchingPreset.value);
}
Expand Down

0 comments on commit 63800fd

Please sign in to comment.