I’ve tried to extend the prosemirror schema to add support for the style
tag.
But the tag is not working in the editor, so a span
tag is added.
I’ve tried to do it with iFrame
and it worked. The issue is with style
.
How should I do it? Here is the schema node that I used. BTW I am using kend-editor, which has prosemirror, so I’m not sure if it’s related to kendo, but I think it’s connected to how Prosemirror works.
const style: NodeSpec = {
content: 'text*',
group: 'block',
selectable: false,
parseDOM: [
{
tag: 'style', // Match <style> tags in the HTML
getAttrs(dom) {
return { content: dom.innerHTML }; // Store the CSS content
},
},
],
toDOM(node) {
console.log('Style Node', node)
return ['style', 0, node.textContent]; // Serialize it back as <style> tag with content
},
};