diff --git a/packages/core/src/extensions/toggleMark.ts b/packages/core/src/extensions/toggleMark.ts index e3de9adb..c00da515 100644 --- a/packages/core/src/extensions/toggleMark.ts +++ b/packages/core/src/extensions/toggleMark.ts @@ -3,6 +3,7 @@ import { MarkType } from 'prosemirror-model' import { Command } from '../Editor' import { createExtension } from '../Extension' import getMarkType from '../utils/getMarkType' +import markIsActive from '../utils/markIsActive' export const ToggleMark = createExtension({ addCommands() { @@ -10,6 +11,17 @@ export const ToggleMark = createExtension({ toggleMark: (typeOrName: string | MarkType): Command => ({ state, dispatch }) => { const type = getMarkType(typeOrName, state.schema) + /* TODO: + const hasMarkWithDifferentAttributes = attrs + && markIsActive(state, type) + && !markIsActive(state, type, attrs) + + if (hasMarkWithDifferentAttributes) { + // @ts-ignore + return commands.updateMark(type, attrs) + } + */ + return originalToggleMark(type)(state, dispatch) }, }