Hi devs
I have two nodes of this type:
Heading:
{
attrs: {
level: {
default: 1,
},
},
content: 'inline*',
group: 'block',
parseDOM: [
{ tag: 'h1', attrs: { level: 1 } },
{ tag: 'h2', attrs: { level: 2 } },
{ tag: 'h3', attrs: { level: 3 } },
{ tag: 'h4', attrs: { level: 4 } },
{ tag: 'h5', attrs: { level: 5 } },
{ tag: 'h6', attrs: { level: 6 } },
],
toDOM(node) {
return [
'h' + node.attrs.level,
0,
];
},
}
List:
import {
listItem as listItemSchema,
orderedList as orderedListSchema,
bulletList as bulletListSchema,
} from 'prosemirror-schema-list';
const listItem = {
...listItemSchema,
content: 'paragraph block*',
};
const orderedList = {
...orderedListSchema,
content: 'listItem+',
group: 'block',
};
const bulletList = {
...bulletListSchema,
content: 'listItem+',
group: 'block',
};
My problem: I can’t change the heading type of node with the list type because their schemas are incompatible. I need to reset the type and then to make it the listItem type by wrapping it in some kind of sheet. What’s the best experience to solve this problem? How to reset the heading type and insert this in the list like the paragraph in one step? Is it possible? I’m afraid that in the future I’ll have many nodes, and I can’t manually interfere with every possible transformation, because there will be so many variations of them.