For the life of me I cannot seem to get the b to wrap the strong tag. I know that’s a weird request. Unfortunately that’s how things are being marked up. It there a way to achieve that? I’ve been messing with priorities and cannot seem to do it.
strong: {
parseDOM: [{
priority: 66,
tag: 'strong',
}],
toDOM() {
return ['strong', 0]
},
},
b: {
attrs: {
data: { default: {} },
},
parseDOM: [
{
priority: 55,
tag: 'b',
getAttrs(dom) {
const attrs = { data: {} }
for (let d in dom.dataset) {
attrs.data[d] = dom.dataset[d]
}
return attrs
},
},
],
toDOM(node) {
const attrs = {}
Object.keys(node.attrs.data).forEach(key => {
attrs[`data-${key}`] = node.attrs.data[key]
})
return ['b', attrs, 0]
},
},