What makes a node generatable?

Why is a text node non-generatable, what is the missing default, and how can I know if a node type is generatable?

I tried to follow the guide to create a simple schema instead of using the schema-basic, but got an error about non-generatable text nodes. It took a while for me to understand, but I see now that I forgot the zero or more qualifier (*) for the text content spec, and confused myself by assuming that the editor would be able to insert an empty text node by itself.

Conversations that helped me understand the issue.

  (let [schema (Schema. (clj->js
                         {:nodes {:doc {:content "paragraph+"}
                                  :paragraph {:content "text" :toDOM (fn [_node] #js ["p" 0])}
                                  :text {:inline true}}}))

SyntaxError: Only non-generatable nodes (text) in a required position (see ProseMirror Guide) (in content expression ‘text’) (at index.cjs:1700:13) at TokenStream.value (index.cjs:1700:13)

Having attributes without default values, or required children that have attributes without defaults.

Thanks, I guess my main question is how do I know which are the attributes of a node that lack default values, but maybe the empty text node is a special case that is not allowed at all.

Edit: Ok, empty text nodes are mentioned in the docs.


This also means each document has one valid representation. Adjacent text nodes with the same set of marks are always combined together, and empty text nodes are not allowed. The order in which marks appear is specified by the schema.