titap: fix unset color

This commit is contained in:
fantasticit 2022-05-06 10:00:35 +08:00
parent bb1924e89b
commit 0b77a58d86
2 changed files with 2 additions and 7 deletions

View File

@ -18,7 +18,7 @@ export const BackgroundColor: React.FC<{ editor: Editor }> = ({ editor }) => {
const backgroundColor = useAttributes(
editor,
'textStyle',
{ backgroundColor: 'transparent' },
{ backgroundColor: null },
(attrs) => attrs.backgroundColor
);
const isTitleActive = useActive(editor, Title.name);

View File

@ -20,12 +20,7 @@ const FlexStyle = {
export const TextColor: React.FC<{ editor: Editor }> = ({ editor }) => {
const isTitleActive = useActive(editor, Title.name);
const isTextStyleActive = useActive(editor, TextStyle.name);
const color = useAttributes<Color, Color['color']>(
editor,
'textStyle',
{ color: 'transparent' },
(attrs) => attrs.color
);
const color = useAttributes<Color, Color['color']>(editor, 'textStyle', { color: null }, (attrs) => attrs.color);
const setColor = useCallback(
(color) => {