dont use data- attributes as default
This commit is contained in:
@@ -8,7 +8,7 @@ export default function getRenderedAttributes(nodeOrMark: Node | Mark, extension
|
|||||||
.map(item => {
|
.map(item => {
|
||||||
if (!item.attribute.renderHTML) {
|
if (!item.attribute.renderHTML) {
|
||||||
return {
|
return {
|
||||||
[`data-${item.name}`]: nodeOrMark.attrs[item.name],
|
[item.name]: nodeOrMark.attrs[item.name],
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ export default function injectExtensionAttributesToParseRule(parseRule: ParseRul
|
|||||||
const attributes = item.attribute.parseHTML
|
const attributes = item.attribute.parseHTML
|
||||||
? item.attribute.parseHTML(node as HTMLElement)
|
? item.attribute.parseHTML(node as HTMLElement)
|
||||||
: {
|
: {
|
||||||
[item.name]: (node as HTMLElement).dataset[item.name],
|
[item.name]: (node as HTMLElement).getAttribute(item.name),
|
||||||
}
|
}
|
||||||
|
|
||||||
const filteredAttributes = Object.fromEntries(Object.entries(attributes)
|
const filteredAttributes = Object.fromEntries(Object.entries(attributes)
|
||||||
|
|||||||
@@ -26,21 +26,9 @@ const Link = createMark({
|
|||||||
return {
|
return {
|
||||||
href: {
|
href: {
|
||||||
default: null,
|
default: null,
|
||||||
renderHTML: attributes => ({
|
|
||||||
href: attributes.href,
|
|
||||||
}),
|
|
||||||
parseHTML: node => ({
|
|
||||||
href: node.getAttribute('href'),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
target: {
|
target: {
|
||||||
default: this.options.target,
|
default: this.options.target,
|
||||||
renderHTML: attributes => ({
|
|
||||||
target: attributes.target,
|
|
||||||
}),
|
|
||||||
parseHTML: node => ({
|
|
||||||
target: node.getAttribute('target'),
|
|
||||||
}),
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user