Skip to content

getSelectedBlocks

const getSelectedBlocks: EditorSelector<object[]>

Defined in: selector.get-selected-blocks.ts:23

Returns the root-level blocks the selection covers.

Only looks at direct children of the editor. If the selection is inside an editable container, the container itself is returned - not its inner blocks. Containers are preserved whole.

Use for block-level operations like move.block up/down and drag-and-drop. For “selection as portable text” use getSelectedValue; for “text blocks at any depth” use getSelectedTextBlocks.