You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The bug is caused by the nodeIsActive() util function which compares the attributes passed in (eg isActive.heading({ level: 1 })) with the attributes of the node (eg {level: 1, align: null}). As the attributes are not exactly the same, the function will return false. One way of coping with that would be to only check if the attributes passed in ({ level: 1 }) are "included" in the node.
Describe the bug
The
isActive
props on menuBar doesn't works if the node's schema contains more attributes than passed in the prop's function.Steps to Reproduce / Codesandbox Example
Add a attribute to the "Heading" extension.
isActive.heading({ level: 1 })
doesn't returntrue
anymore.Explanation
The bug is caused by the
nodeIsActive()
util function which compares the attributes passed in (egisActive.heading({ level: 1 })
) with the attributes of the node (eg{level: 1, align: null}
). As the attributes are not exactly the same, the function will returnfalse
. One way of coping with that would be to only check if the attributes passed in ({ level: 1 }
) are "included" in the node.Solution
Replace https://github.com/scrumpy/tiptap/blob/master/packages/tiptap-utils/src/utils/nodeIsActive.js#L15
with
return node.node.hasMarkup(type, {...node.node.attrs, ...attrs})
The text was updated successfully, but these errors were encountered: