add todo
This commit is contained in:
@@ -3,6 +3,7 @@ import { MarkType } from 'prosemirror-model'
|
|||||||
import { Command } from '../Editor'
|
import { Command } from '../Editor'
|
||||||
import { createExtension } from '../Extension'
|
import { createExtension } from '../Extension'
|
||||||
import getMarkType from '../utils/getMarkType'
|
import getMarkType from '../utils/getMarkType'
|
||||||
|
import markIsActive from '../utils/markIsActive'
|
||||||
|
|
||||||
export const ToggleMark = createExtension({
|
export const ToggleMark = createExtension({
|
||||||
addCommands() {
|
addCommands() {
|
||||||
@@ -10,6 +11,17 @@ export const ToggleMark = createExtension({
|
|||||||
toggleMark: (typeOrName: string | MarkType): Command => ({ state, dispatch }) => {
|
toggleMark: (typeOrName: string | MarkType): Command => ({ state, dispatch }) => {
|
||||||
const type = getMarkType(typeOrName, state.schema)
|
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)
|
return originalToggleMark(type)(state, dispatch)
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user