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( const backgroundColor = useAttributes(
editor, editor,
'textStyle', 'textStyle',
{ backgroundColor: 'transparent' }, { backgroundColor: null },
(attrs) => attrs.backgroundColor (attrs) => attrs.backgroundColor
); );
const isTitleActive = useActive(editor, Title.name); const isTitleActive = useActive(editor, Title.name);

View File

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