I know this question has already been asked, Schema is missing its top node type ('doc')

I fell into this error just like the previous guy.

I have been on it for 2days now

Is there a doc node defined in this.nodes?

1 Like

there is no ‘doc’ found in this.nodes method

it’s a custom method meant to be extensible

… Okay. If you don’t provide a node that matches the top node name, you’re going to get this error. To solve the error, make sure the top node name (which defaults to "doc") exists. That seems pretty obvious.

1 Like

Please what a topnode? having been scanning through your code on GitHub

Every schema must at least define a top-level node type (which defaults to the name “doc”, but you can configure that), and a “text” type for text content.

topNodeType: NodeType

A full document is just a node. The document content is represented as the top-level node’s child nodes. Typically, it’ll contain a series of block nodes, some of which may be textblocks that contain inline content. But the top-level node may also be a textblock itself, so that the document contains only inline content.

Schemas

Each ProseMirror document has a schema associated with it. The schema describes the kind of nodes that may occur in the document, and the way they are nested. For example, it might say that the top-level node can contain one or more blocks, and that paragraph nodes can contain any number of inline nodes, with any marks applied to them.

1 Like

what a superb project