When creating a new node type the defaultAttrs function is used. But instead of setting up the default value, it adds the entire Attribute object there.
This leads to the created objects with CreateAndFill to have a bad format, this also affects the (n *Node) ToJSON method since the resulting object cannot be JSON-serialised if it has any Attributes.
When creating a new node type the defaultAttrs function is used. But instead of setting up the default value, it adds the entire Attribute object there. This leads to the created objects with CreateAndFill to have a bad format, this also affects the
(n *Node) ToJSON
method since the resulting object cannot be JSON-serialised if it has any Attributes.Here is the original prosemirror-model counterpart of the method where you can see that
attr.default
is added to the map instead of justattr
. https://github.com/cozy/prosemirror-go/blob/master/model/schema.go#L21 https://github.com/ProseMirror/prosemirror-model/blob/master/src/schema.ts#L22