merge attributes

This commit is contained in:
Philipp Kühn
2020-10-23 15:02:52 +02:00
parent e01a0b8484
commit ecadf7ea0a
4 changed files with 32 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import { Node, Mark } from 'prosemirror-model'
import { ExtensionAttribute } from '../types'
import mergeAttributes from './mergeAttributes'
export default function getRenderedAttributes(nodeOrMark: Node | Mark, extensionAttributes: ExtensionAttribute[]): { [key: string]: any } {
return extensionAttributes
@@ -9,10 +10,6 @@ export default function getRenderedAttributes(nodeOrMark: Node | Mark, extension
return item.attribute.renderHTML(nodeOrMark.attrs)
})
.reduce((attributes, attribute) => {
// TODO: add support for "class" and "style" merge
return {
...attributes,
...attribute,
}
return mergeAttributes(attributes, attribute)
}, {})
}