initial commit
This commit is contained in:
12
src/utils/nodeIsActive.js
Normal file
12
src/utils/nodeIsActive.js
Normal file
@@ -0,0 +1,12 @@
|
||||
import { findParentNode } from 'prosemirror-utils'
|
||||
|
||||
export default function (state, type, attrs) {
|
||||
const predicate = node => node.type === type
|
||||
const parent = findParentNode(predicate)(state.selection)
|
||||
|
||||
if (attrs === {} || !parent) {
|
||||
return !!parent
|
||||
}
|
||||
|
||||
return parent.node.hasMarkup(type, attrs)
|
||||
}
|
||||
Reference in New Issue
Block a user