Creating a Node
Use the staticcreate method to define a new node.
Partial<NodeConfig<Options, Storage>> | (() => Partial<NodeConfig<Options, Storage>>)
The node configuration object or a function that returns a configuration object.
Configuration Options
Nodes inherit all configuration options from Extension, plus the following:content
Define the content expression for the node.string
A ProseMirror content expression defining what content this node can contain.
marks
Define which marks are allowed inside the node.string
Space-separated mark names,
"_" to allow all marks, or "" to disallow marks.group
Define the group(s) this node belongs to.string
Space-separated group names (e.g.,
'block', 'inline').inline
Whether the node is an inline node.boolean
default:"false"
Set to
true for inline nodes.atom
Whether the node is atomic (non-editable as a unit).boolean
default:"false"
Set to
true for atomic nodes that should be treated as a single unit.selectable
Whether the node can be selected.boolean
default:"true"
Whether the node can be selected with a node selection.
draggable
Whether the node can be dragged.boolean
default:"false"
Whether the node can be dragged without being selected.
code
Whether the node contains code.boolean
default:"false"
Indicates that this node contains code, affecting command behavior.
defining
Whether the node is defining.boolean
default:"false"
When enabled, affects context for schema operations.
isolating
Whether the node is isolating.boolean
default:"false"
When enabled, the sides of this node count as boundaries that regular editing operations won’t cross.
topNode
Whether this node should be the top-level node (document).boolean
default:"false"
Set to
true for the document node.parseHTML()
Define how to parse HTML into this node.renderHTML()
Define how to render the node as HTML.renderText()
Define how to render the node as plain text.addAttributes()
Define attributes for the node.addNodeView()
Define a custom node view.Methods
configure()
Create a configured version of the node.Partial<Options>
Options to override the default options.
extend()
Extend the node with additional configuration.Partial<ExtendedConfig> | (() => Partial<ExtendedConfig>)
Additional configuration or a function that returns configuration.