DX sugar porting prosemirror-schema-list
node specs and addListNodes/3.
Provides base specs for ordered and bullet lists and list items, plus helpers
to append them to a schema node list. Does not include list commands
(wrapInList, splitListItem, etc.).
Example
nodes =
ProsemirrorEx.Schema.Basic.nodes()
|> add_list_nodes("paragraph block*", "block")
schema = ProsemirrorEx.Model.Schema.new(%{
"nodes" => nodes,
"marks" => ProsemirrorEx.Schema.Basic.marks()
})
Summary
Functions
Appends ordered_list, bullet_list, and list_item to a node list.
Base bullet list node spec.
Base list item node spec.
Returns the three list node entries as {name, spec} tuples.
Base ordered list node spec.
Functions
@spec add_list_nodes([{String.t(), map()}], String.t(), String.t() | nil) :: [ {String.t(), map()} ]
Appends ordered_list, bullet_list, and list_item to a node list.
nodes is a list of {name, spec} tuples in this project's schema format.
Returns a new list with the three list nodes appended.
@spec bullet_list() :: map()
Base bullet list node spec.
Content and group are not set — use add_list_nodes/3 or nodes/2 to fill
those in.
@spec list_item() :: map()
Base list item node spec.
Marked as defining. Content is not set — use add_list_nodes/3 or nodes/2
to fill it in.
Returns the three list node entries as {name, spec} tuples.
item_content sets the list item content expression (e.g. "paragraph block*").
When list_group is a string, both list types get "group" => list_group;
when nil, no group is set.
@spec ordered_list() :: map()
Base ordered list node spec.
Has a single order attribute defaulting to 1. Content and group are not
set — use add_list_nodes/3 or nodes/2 to fill those in.