Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
print: val => {
if (isEditorState(val)) {
return `Prosemirror doc: ${JSON.stringify(
val.doc.toJSON(),
null,
2,
)}\nProsemirror selection: ${JSON.stringify(val.selection, null, 2)}`;
}
if (isEditorSchema(val)) {
const nodes = keys(val.nodes).reduce((acc, key) => {
const { spec } = val.nodes[key];
return { ...acc, [key]: spec };
}, {});
const marks = keys(val.marks).reduce((acc, key) => {
const { spec } = val.marks[key];
return { ...acc, [key]: spec };
}, {});
return `Prosemirror schema: ${JSON.stringify(
{
nodes,
marks,
},
null,
2,