improve attribute handling

This commit is contained in:
Philipp Kühn
2020-10-27 14:53:08 +01:00
parent fd278f922f
commit 77f67bceae
3 changed files with 4 additions and 4 deletions

View File

@@ -12,7 +12,7 @@ export default function getRenderedAttributes(nodeOrMark: Node | Mark, extension
}
}
return item.attribute.renderHTML(nodeOrMark.attrs)
return item.attribute.renderHTML(nodeOrMark.attrs) || {}
})
.reduce((attributes, attribute) => {
return mergeAttributes(attributes, attribute)

View File

@@ -27,7 +27,7 @@ export default function injectExtensionAttributesToParseRule(parseRule: ParseRul
.filter(item => item.attribute.rendered)
.reduce((items, item) => {
const attributes = item.attribute.parseHTML
? item.attribute.parseHTML(node as HTMLElement)
? item.attribute.parseHTML(node as HTMLElement) || {}
: {
[item.name]: (node as HTMLElement).getAttribute(item.name),
}