# BlockEditorActions (@salmonui/rich-text)

> The BlockEditorActions interface of @salmonui/rich-text: actionsRef.

Canonical: https://salmonui.dev/docs/reference/rich-text/BlockEditorActions

```ts
import type { BlockEditorActions } from '@salmonui/rich-text';
```

Entry index: https://salmonui.dev/docs/reference/rich-text (Markdown with every symbol of the entry: https://salmonui.dev/docs/reference/rich-text.md).

## Reference

Kind: interface

```ts
interface BlockEditorActions {
    getBlocks(): Block[];
    getBlock(id: string): Block | undefined;
    insertBlocks(blocks: readonly Block[], position?: BlockPosition): void;
    removeBlocks(ids: readonly string[]): void;
    updateBlock(id: string, patch: BlockPatch): void;
    moveBlock(id: string, position: BlockPosition): boolean;
    turnInto(id: string, type: BlockEditorTransformId): void;
    getSelection(): BlockEditorSelection | null;
    setSelection(selection: BlockEditorSelection): void;
    focus(): void;
    runCommand(id: string, ...args: unknown[]): boolean;
    getHtml(): string;
    print(): void;
}
```

`actionsRef`.

Members (13):

| Name | Signature | Flags | Description |
| --- | --- | --- | --- |
| `getBlocks` | `getBlocks(): Block[];` |  | The current document. |
| `getBlock` | `getBlock(id: string): Block \| undefined;` |  |  |
| `insertBlocks` | `insertBlocks(blocks: readonly Block[], position?: BlockPosition): void;` |  |  |
| `removeBlocks` | `removeBlocks(ids: readonly string[]): void;` |  |  |
| `updateBlock` | `updateBlock(id: string, patch: BlockPatch): void;` |  |  |
| `moveBlock` | `moveBlock(id: string, position: BlockPosition): boolean;` |  | Returns false when cancelled by `onBeforeBlockMove` or not possible. |
| `turnInto` | `turnInto(id: string, type: BlockEditorTransformId): void;` |  |  |
| `getSelection` | `getSelection(): BlockEditorSelection \| null;` |  |  |
| `setSelection` | `setSelection(selection: BlockEditorSelection): void;` |  |  |
| `focus` | `focus(): void;` |  |  |
| `runCommand` | `runCommand(id: string, ...args: unknown[]): boolean;` |  | Runs a toolbar action or command by id (`bold`, `heading2`, `insertTable`, `undo`, `print`, ...). |
| `getHtml` | `getHtml(): string;` |  |  |
| `print` | `print(): void;` |  |  |
