Skip to content

Commit

Permalink
[@mantine/tiptap] ColorPickerControl: fix incorrect color displayed
Browse files Browse the repository at this point in the history
  • Loading branch information
HoHieuLuc committed Aug 17, 2023
1 parent 33f51e1 commit 7603432
Showing 1 changed file with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,12 @@ export const ColorPickerControl = forwardRef<HTMLButtonElement, ColorPickerContr
const [state, setState] = useState<'palette' | 'colorPicker'>('palette');
const theme = useMantineTheme();
const currentColor =
editor?.getAttributes('textStyle').color || theme.colorScheme === 'dark'
? theme.colors.dark[1]
: theme.black;
editor?.getAttributes('textStyle').color
|| (
theme.colorScheme === 'dark'
? theme.colors.dark[1]
: theme.black
);

const handleChange = (value: string, shouldClose = true) => {
(editor.chain() as any).focus().setColor(value).run();
Expand Down

0 comments on commit 7603432

Please sign in to comment.