diff --git a/src/bundle/toolbar/markup/MToolbarColors.tsx b/src/bundle/toolbar/markup/MToolbarColors.tsx index c99d6630a..ad0368c99 100644 --- a/src/bundle/toolbar/markup/MToolbarColors.tsx +++ b/src/bundle/toolbar/markup/MToolbarColors.tsx @@ -10,6 +10,7 @@ export const MToolbarColors: React.FC = ({ focus, onClick, }) => { + // TODO: @makhnatkin check markup mode return ( = ({ enable={action.isEnable()} currentColor={currentColor} exec={(color) => { - action.run({color: color === currentColor ? '' : color}); + action.run({color}); }} disablePortal={disablePortal} className={className} diff --git a/src/extensions/yfm/Color/index.ts b/src/extensions/yfm/Color/index.ts index 8c18fcaaa..40b501c49 100644 --- a/src/extensions/yfm/Color/index.ts +++ b/src/extensions/yfm/Color/index.ts @@ -35,6 +35,10 @@ export const Color: ExtensionAuto = (builder) => { if (!hasMark) return true; // remove mark + // TODO: @makhnatkin currently params[colorMarkName] = '' is sent + // when clicking the same color repeatedly + // because of this we can't determine which color it was, we need to always send the color, + // but handle the removal logic differently return toggleMark(type, params)(state, dispatch); } diff --git a/src/utils/actions.ts b/src/utils/actions.ts index 9ce719fea..4c814f7eb 100644 --- a/src/utils/actions.ts +++ b/src/utils/actions.ts @@ -10,7 +10,9 @@ export function defineActions(actions: Record Boolean(isMarkActive(state, markType)), isEnable: command,