diff --git a/packages/tiptap-utils/src/index.js b/packages/tiptap-utils/src/index.js index 2a37713da..416af39c3 100644 --- a/packages/tiptap-utils/src/index.js +++ b/packages/tiptap-utils/src/index.js @@ -1,4 +1,5 @@ export { default as getMarkAttrs } from './utils/getMarkAttrs' export { default as getMarkRange } from './utils/getMarkRange' export { default as markIsActive } from './utils/markIsActive' +export { default as nodeEqualsType } from './utils/nodeEqualsType' export { default as nodeIsActive } from './utils/nodeIsActive' diff --git a/packages/tiptap-utils/src/utils/nodeEqualsType.js b/packages/tiptap-utils/src/utils/nodeEqualsType.js new file mode 100644 index 000000000..09d0f6f0f --- /dev/null +++ b/packages/tiptap-utils/src/utils/nodeEqualsType.js @@ -0,0 +1,3 @@ +export default function nodeEqualsType({ types, node }) { + return (Array.isArray(types) && types.includes(node.type)) || node.type === types +}