Skip to content

Type Editor


Type Editor / @type-editor/commands / toggle-block-type

toggle-block-type

Functions

FunctionDescription

toggleBlockType

Creates a command that toggles between two block types.

If the selection is currently inside a node of the specified nodeType and unwrapping is allowed, it will convert the block to unwrapNodeType. Otherwise, it will convert the block to nodeType.

This is useful for implementing toggle buttons (e.g., toggling between a heading and a paragraph).