Function: docFromJSON()
ts
function docFromJSON(schema, json): Node;Turn a DocJSON into a ProseMirror document of schema: migrates older format versions, accepts an empty document, and checks every node. Throws an error that says how to fix the document (or the extensions) when it does not fit the schema.
The editor, toHTML() and toMarkdown() load documents with it; use it in code that builds on the schema directly.
Parameters
| Parameter | Type |
|---|---|
schema | Schema |
json | DocJSON |
Returns
Node
Example
ts
const schema = createSchema(extensions)
const node = docFromJSON(schema, saved)