From 76034326d09e75c61487c347affeb89787781646 Mon Sep 17 00:00:00 2001 From: Luc Date: Thu, 17 Aug 2023 11:46:45 +0700 Subject: [PATCH 1/2] [@mantine/tiptap] ColorPickerControl: fix incorrect color displayed --- .../controls/ColorPickerControl/ColorPickerControl.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx b/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx index 53436f2e2fd..83b00535424 100644 --- a/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx +++ b/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx @@ -46,9 +46,12 @@ export const ColorPickerControl = forwardRef('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(); From c9ffa9174440c80d6ca752d9411a9f51b9236584 Mon Sep 17 00:00:00 2001 From: Luc Date: Thu, 17 Aug 2023 17:15:06 +0700 Subject: [PATCH 2/2] fix code style --- .../controls/ColorPickerControl/ColorPickerControl.tsx | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx b/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx index 83b00535424..999a64d6ec4 100644 --- a/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx +++ b/src/mantine-tiptap/src/controls/ColorPickerControl/ColorPickerControl.tsx @@ -46,12 +46,8 @@ export const ColorPickerControl = forwardRef('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();