feat: allow wildcards when checking attributes in isActive, fix #1752

This commit is contained in:
Philipp Kühn
2021-08-20 10:51:46 +02:00
parent c473f550c7
commit 64409cad66
5 changed files with 149 additions and 8 deletions

View File

@@ -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