Example code:
const mySchema = new Schema({
nodes: {
doc: {
content: "foo*"
},
foo: {
content: "text*",
parseDOM: [{tag: "p"}]
},
text: {},
},
});
const element = document.createElement('div');
element.innerHTML = '<div>Hello World!</div>';
const myDoc = DOMParser.fromSchema(mySchema).parse(element);
console.log(myDoc.toString()); // ❓ doc(foo("Hello World!"))
As you can see, the HTML which we pass to parser is <div>Hello World</div>
but foo
node require p
HTML tag. So why we are still parse such document as doc(foo(...))
ignoring parse rule. I would rather expect that parser returns empty document doc()
but maybe my conceptual model is wrong. Would glad to hear why it behaves like it’s now.
Thanks