Skip to content

Commit

Permalink
BUGFIX: Prevent error when entering hex value
Browse files Browse the repository at this point in the history
Color library was incorrectly resolved when minified. So now I import the necessary method to check the hex value.

Resolves: #55
  • Loading branch information
Sebobo committed Jan 17, 2022
1 parent 38632ed commit 0b445d1
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
Expand Up @@ -67,8 +67,6 @@ export default class ColorPickerEditor extends PureComponent {
presetColors = options.presetColors;
}

console.log(this.props, 'colorpicker props');

return (
<div>
<NeosColorPicker
Expand Down
@@ -1,6 +1,6 @@
import React from 'react';
import reactCSS from 'reactcss';
import color from 'react-color/lib/helpers/color';
import {isValidHex} from 'react-color/lib/helpers/color';
import {EditableInput} from 'react-color/lib/components/common';

export const Fields = ({onChange, rgb, hsl, hex, disableAlpha}) => {
Expand Down Expand Up @@ -51,7 +51,7 @@ export const Fields = ({onChange, rgb, hsl, hex, disableAlpha}) => {

const handleChange = (data, e) => {
if (data.hex) {
if (color.isValidHex(data.hex)) {
if (isValidHex(data.hex)) {
onChange({
hex: data.hex,
source: 'hex'
Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/ColorPickerEditor/Plugin.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion Resources/Public/ColorPickerEditor/Plugin.js.map

Large diffs are not rendered by default.

0 comments on commit 0b445d1

Please sign in to comment.