ProsemirrorEx.Model.NodeType (prosemirror_ex v0.3.0)

Copy Markdown View Source

A node type is a specification for a type of node in a schema.

Summary

Functions

Removes the marks that are not allowed in this node from the given set.

Check whether this node type allows a given mark type.

Test whether the given set of marks are allowed in this node.

Validate attributes against the spec.

Raises a RuntimeError if the given fragment is not valid content for this node type.

Indicates whether this node allows some of the same content as the given node type.

Compute attrs, filling in defaults for missing values.

Create a Node of this type. The given attributes are checked and defaulted. content may be a Fragment, a node, an array of nodes, or nil. Similarly marks may be nil to default to the empty set. Does NOT check content against the content expression.

Like create, but see if it is necessary to add nodes to the start or end of the given fragment to make it fit the node. If no fitting wrapping can be found, return nil.

Like create, but check the given content against the node type's content restrictions, and raise an error if it doesn't match.

Check whether this node type has any required attributes.

Check whether this node type is in the given group.

Returns true if the given fragment is valid content for this node type.

Get the whitespace mode for this node type.

Functions

allowed_marks(type, marks)

Removes the marks that are not allowed in this node from the given set.

allows_mark_type(node_type, mark_type)

Check whether this node type allows a given mark type.

allows_marks(type, marks)

Test whether the given set of marks are allowed in this node.

check_attrs(node_type, values)

Validate attributes against the spec.

check_content(type, content)

Raises a RuntimeError if the given fragment is not valid content for this node type.

compatible_content(node_type1, node_type2)

Indicates whether this node allows some of the same content as the given node type.

compute_attrs(node_type, value)

Compute attrs, filling in defaults for missing values.

create(type, attrs \\ nil, content \\ nil, marks \\ nil)

Create a Node of this type. The given attributes are checked and defaulted. content may be a Fragment, a node, an array of nodes, or nil. Similarly marks may be nil to default to the empty set. Does NOT check content against the content expression.

create_and_fill(type, attrs \\ nil, content \\ nil, marks \\ nil)

Like create, but see if it is necessary to add nodes to the start or end of the given fragment to make it fit the node. If no fitting wrapping can be found, return nil.

create_checked(type, attrs, content, marks \\ nil)

Like create, but check the given content against the node type's content restrictions, and raise an error if it doesn't match.

has_required_attrs?(node_type)

Check whether this node type has any required attributes.

is_in_group(node_type, group)

Check whether this node type is in the given group.

valid_content(type, content)

Returns true if the given fragment is valid content for this node type.

whitespace(node_type)

Get the whitespace mode for this node type.