Hey all,
I’m using GrapesJS’s plugin for Prosemirror (https://app.grapesjs.com/docs-sdk/plugins/rte/prosemirror) but it looks like they’ve configured their schema to output <div> tags for everything instead of semantic HTML like paragraph tags. I’ve been able to extend the schema and modify it to do so with the code below, however some things are breaking as a result:
-
Text Align no longer functions correctly, when I click on those buttons nothing happens - no error logging or anything. I suspect this is because I’m updating the “div” node but not confirmed
-
Setting text to a header and then back to normal text results in it converting from paragraph → header → div, so my fix below isn’t actually kicking in when I use the header options apparently
Any ideas how to solve these? Thanks!
StudioSdkPlugins_prosemirror.init({
schema: ({ schema }) => {
const Schema = schema.constructor;
const newNodes = schema.spec.nodes.update("div", {
...schema.spec.nodes.get("div"),
parseDOM: [{ tag: "p" }],
toDOM() { return ["p", { class: 'x_text' }, 0]; }
});
return new Schema({
nodes: newNodes,
marks: schema.spec.marks
});
},