We are trying to prevent deletion of a node on pressing backspace. For some reason, the node is getting deleted when the content becomes empty. Are we missing anything here? Is there a workaround that we can do to stop the deletion?
This is how we have modeled our schema.
const nodes = {
story: {
content: "card*"
},
card: {
selectable: false,
atom: true,
marks: "",
isolating: true,
content: "story_element*",
attrs: {
id: { default: "" },
"content-version-id": { default: "" },
"story-version-id": { default: "" },
"client-id": { default: "" }
},
parseDOM: [{ tag: "div.card" }],
toDOM() {
return ["div", { class: "card" }, 0];
}
},
story_element_text: {
group: "story_element",
content: "block*",
atom: true,
isolating: true,
attrs: {
id: { default: "" },
"client-id": { default: "" },
type: { default: "text" },
subtype: { default: null },
"story-version-id": { default: "" },
"card-id": { default: "" }
},
parseDOM: [{ tag: "div.story-element.story-element-text" }],
toDOM() {
return ["div", { class: "story-element story-element-text" }, 0];
}
},
paragraph: {
content: "inline*",
group: "block",
parseDOM: [{ tag: "p" }],
toDOM() {
return ["p", 0];
}
},
text: {
group: "inline"
}
};
const schema = new Schema({
nodes: addListNodes(OrderedMap.from(nodes), "(paragraph | heading) block*", "block"),
marks,
topNode: "story"
});