mirror of
https://github.com/ueberdosis/tiptap.git
synced 2024-12-23 00:27:49 +08:00
22 lines
561 B
TypeScript
22 lines
561 B
TypeScript
|
import { AnyObject, ExtensionAttribute } from '../types'
|
||
|
|
||
|
export default function getSplittedAttributes(
|
||
|
extensionAttributes: ExtensionAttribute[],
|
||
|
typeName: string,
|
||
|
attributes: AnyObject,
|
||
|
): AnyObject {
|
||
|
return Object.fromEntries(Object
|
||
|
.entries(attributes)
|
||
|
.filter(([name]) => {
|
||
|
const extensionAttribute = extensionAttributes.find(item => {
|
||
|
return item.type === typeName && item.name === name
|
||
|
})
|
||
|
|
||
|
if (!extensionAttribute) {
|
||
|
return false
|
||
|
}
|
||
|
|
||
|
return extensionAttribute.attribute.keepOnSplit
|
||
|
}))
|
||
|
}
|