Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bundle/toolbar/markup/MToolbarColors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const MToolbarColors: React.FC<MToolbarColorsProps> = ({
focus,
onClick,
}) => {
// TODO: @makhnatkin check markup mode
return (
<ToolbarColors
enable
Expand Down
2 changes: 1 addition & 1 deletion src/bundle/toolbar/wysiwyg/WToolbarColors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const WToolbarColors: React.FC<WToolbarColorsProps> = ({
enable={action.isEnable()}
currentColor={currentColor}
exec={(color) => {
action.run({color: color === currentColor ? '' : color});
action.run({color});
}}
disablePortal={disablePortal}
className={className}
Expand Down
4 changes: 4 additions & 0 deletions src/extensions/yfm/Color/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
4 changes: 3 additions & 1 deletion src/utils/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ export function defineActions<Keys extends string>(actions: Record<Keys, ActionS
}

export function createToggleMarkAction(markType: MarkType): ActionSpec {
const command = toggleMark(markType);
const command = toggleMark(markType, undefined, {
removeWhenPresent: false,
});
return {
isActive: (state) => Boolean(isMarkActive(state, markType)),
isEnable: command,
Expand Down
Loading