Skip to main content

Module editor

Module editor 

Source
Expand description

What a module adds to the editing surfaces: commands an author inserts from the toolbar’s Insert menu, and snippets (configurable blocks a theme or module defines) placed into rich text or markdown. Both are data: a module never injects a script into an editor.

A command is registered at boot through AdminRegistry::add_editor_command; snippets come from a SnippetSource asked at request time, because a theme’s partials change while the application runs. The surfaces read both from GET <admin>/editor/menu?surface=<key>.

Structs§

EditorCommand
An Insert-menu entry a module contributes to one surface.
Menu
The menu a surface shows: its commands (localized) and, for rich text and markdown, the snippets.
MenuCommand
Snippet
A configurable block an author inserts, expanded by the site at render.
SnippetProperty
A property a snippet’s dialog asks for, passed to the snippet by code.
SnippetSourceReg
A registered snippet source. See AdminRegistry::add_snippet_source.

Enums§

Insert
What a command puts at the caret: HTML for the rich surface, text for markdown. A command declared with the wrong kind for its surface is dropped with a boot log line.
SnippetPropertyKind
What a snippet property holds, and how its dialog asks for it.
Surface
An editing surface a command or snippet targets.

Traits§

SnippetSource
Lists the snippets available now. A theme module implements it over its partials; a module whose snippets are fixed returns a constant list.