Skip to content
This page is available as Markdown at /api/selectors/variables/getselectedblocks.md. For the full documentation index, see /llms.txt, or the complete corpus at /llms-full.txt.

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.