Documentation

Extension reference

Use these fields to define an Extension object. For an example with a validated attribute and custom commands, see Define an extension.

Field Use
name Unique extension name.
marks Inline tags, JSON types, aliases, and attribute rules.
blocks Block tags, JSON types, aliases, and fixed JSON attributes.
blockStyles Allowed CSS properties and values for blocks.
commands Map command names to functions that receive an editor and a value.
keyboardShortcuts Map key combinations to command names.
isActive Report active state for the current selection.

An attribute rule returns the value to keep or null. Start with the public editing methods such as setMark, setBlock, and setBlockStyle. For a custom DOM operation, use editor.change(edit) to record the edit in history and normalize the result. See the extension API for the full method list.