I use two schemes on my site: one for posts, the other for comments. Comments are missing some formatting options, such as lists or tables. In some cases, the content of a post created with an extended schema can be submitted for editing to the comments editor. In this case, I would like node types that are not present in the comment schema to be converted to plain text, similar to what happens with cut and past. However, when trying to parse content like this
let doc: Node|undefined;
if (content) {
try {
doc = Node.fromJSON(schema, JSON.parse(content));
} catch (error) {
console.error(`Can not parse Prose format: ${error}`);
}
}
exception is thrown to nodes that are not present in the schema. Is there a way to convert missing nodes in the schema?