tiptap/packages/core/src/utils/markHasAttributes.ts

10 lines
338 B
TypeScript
Raw Normal View History

2020-10-05 23:12:57 +08:00
import { EditorState } from 'prosemirror-state'
import { MarkType } from 'prosemirror-model'
import getMarkAttrs from './getMarkAttrs'
export default function markHasAttributes(state: EditorState, type: MarkType, attrs?: Object) {
return attrs === null || JSON.stringify(attrs) === JSON.stringify(
getMarkAttrs(state, type),
)
}