improve attributes
This commit is contained in:
@@ -26,9 +26,12 @@ export default function injectExtensionAttributesToParseRule(parseRule: ParseRul
|
||||
[item.name]: (node as HTMLElement).dataset[item.name],
|
||||
}
|
||||
|
||||
const filteredAttributes = Object.fromEntries(Object.entries(attributes)
|
||||
.filter(([, value]) => value !== undefined && value !== null))
|
||||
|
||||
return {
|
||||
...items,
|
||||
...attributes,
|
||||
...filteredAttributes,
|
||||
}
|
||||
}, {})
|
||||
|
||||
|
||||
@@ -39,8 +39,7 @@ const Link = createMark({
|
||||
target: attributes.target,
|
||||
}),
|
||||
parseHTML: node => ({
|
||||
// TODO: always return default value on `null` or `undefined`
|
||||
target: node.getAttribute('target') || this.options.target,
|
||||
target: node.getAttribute('target'),
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user