fix(editor): prevent text color removal from other list items when setting color in lists (#1289)

Only unset color when 'Default' is selected. This ensures setting color on one list item does not remove it from others.
This commit is contained in:
Philip Okugbe
2025-06-23 19:31:30 +01:00
committed by GitHub
parent 65b01038d7
commit e775e4dd8c

View File

@ -156,13 +156,11 @@ export const ColorSelector: FC<ColorSelectorProps> = ({
) )
} }
onClick={() => { onClick={() => {
editor.commands.unsetColor(); if (name === "Default") {
name !== "Default" && editor.commands.unsetColor();
editor } else {
.chain() editor.chain().focus().setColor(color || "").run();
.focus() }
.setColor(color || "")
.run();
setIsOpen(false); setIsOpen(false);
}} }}
style={{ border: "none" }} style={{ border: "none" }}