feat: allow wildcards when checking attributes in isActive, fix #1752
This commit is contained in:
@@ -23,7 +23,7 @@ export default function isMarkActive(
|
||||
|
||||
return type.name === mark.type.name
|
||||
})
|
||||
.find(mark => objectIncludes(mark.attrs, attributes))
|
||||
.find(mark => objectIncludes(mark.attrs, attributes, { strict: false }))
|
||||
}
|
||||
|
||||
let selectionRange = 0
|
||||
@@ -58,7 +58,7 @@ export default function isMarkActive(
|
||||
|
||||
return type.name === markRange.mark.type.name
|
||||
})
|
||||
.filter(markRange => objectIncludes(markRange.mark.attrs, attributes))
|
||||
.filter(markRange => objectIncludes(markRange.mark.attrs, attributes, { strict: false }))
|
||||
.reduce((sum, markRange) => {
|
||||
const size = markRange.to - markRange.from
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ export default function isNodeActive(
|
||||
|
||||
return type.name === nodeRange.node.type.name
|
||||
})
|
||||
.find(nodeRange => objectIncludes(nodeRange.node.attrs, attributes))
|
||||
.find(nodeRange => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }))
|
||||
}
|
||||
|
||||
const selectionRange = to - from
|
||||
@@ -51,7 +51,7 @@ export default function isNodeActive(
|
||||
|
||||
return type.name === nodeRange.node.type.name
|
||||
})
|
||||
.filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes))
|
||||
.filter(nodeRange => objectIncludes(nodeRange.node.attrs, attributes, { strict: false }))
|
||||
.reduce((sum, nodeRange) => {
|
||||
const size = nodeRange.to - nodeRange.from
|
||||
return sum + size
|
||||
|
||||
Reference in New Issue
Block a user