mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-11-27 23:15:15 +08:00
dont use data- attributes as default
This commit is contained in:
parent
4b046d7034
commit
2c52f0ce06
@ -8,7 +8,7 @@ export default function getRenderedAttributes(nodeOrMark: Node | Mark, extension
|
||||
.map(item => {
|
||||
if (!item.attribute.renderHTML) {
|
||||
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
|
||||
? 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)
|
||||
|
@ -26,21 +26,9 @@ const Link = createMark({
|
||||
return {
|
||||
href: {
|
||||
default: null,
|
||||
renderHTML: attributes => ({
|
||||
href: attributes.href,
|
||||
}),
|
||||
parseHTML: node => ({
|
||||
href: node.getAttribute('href'),
|
||||
}),
|
||||
},
|
||||
target: {
|
||||
default: this.options.target,
|
||||
renderHTML: attributes => ({
|
||||
target: attributes.target,
|
||||
}),
|
||||
parseHTML: node => ({
|
||||
target: node.getAttribute('target'),
|
||||
}),
|
||||
},
|
||||
}
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user