The node registry.
The registry maps each Lexical node type to the module that reads it. It
has the built-in nodes, the nodes in the :nodes key of the :kotoba
application config, and the nodes that the caller gives. An app node
cannot have the type of a built-in node or of an editor node
("kotoba-unknown" or "kotoba-upload", see reserved_types/0): the
registry raises ArgumentError, as the editor refuses such a node. A caller node replaces a configured node with the
same type:
config :kotoba, nodes: [MyApp.Nodes.Pointer]Kotoba.Document.parse/2, Kotoba.Content.rerender/2 and
Kotoba.Components.kotoba_content/1 take the caller's nodes as a
nodes option. Kotoba.Content.cast/1 uses the built-in and the
configured nodes only, so put a node that stored content uses in the
config. mix kotoba.gen.node writes a new node module and its editor
half.
Summary
Types
A map from a node type to its module.
Functions
Returns the built-in node modules.
Returns the registry for a list of extra node modules.
Returns the node types that an app node cannot have: the types of the
built-in nodes, and the editor's own node types, "kotoba-unknown" (the
node for a type it does not know) and "kotoba-upload" (the marker of
an upload in progress).
Types
Functions
@spec built_in() :: [module()]
Returns the built-in node modules.
Returns the registry for a list of extra node modules.
Raises ArgumentError when a module does not use Kotoba.Node, or when
the type of a configured node or of a node in nodes is a reserved type
(see reserved_types/0).
@spec reserved_types() :: [String.t()]
Returns the node types that an app node cannot have: the types of the
built-in nodes, and the editor's own node types, "kotoba-unknown" (the
node for a type it does not know) and "kotoba-upload" (the marker of
an upload in progress).