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.
- How to create a nodetype consist of an image and text with inline editing experience?
- Empty text nodes are not allowed… so how to initialize with an empty paragraph?
- "Only non-generatable nodes after a match state" error could use clarification · Issue #758 · ProseMirror/prosemirror · GitHub
(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)