---
title: "DroppyMarkdownEditorCommands, DroppyKit"
description: "A handle onto the host editor&#x27;s command bus (DroppyKit 0.2.2)."
canonical: "https://getdroppy.app/docs/droppykit/api/droppy-markdown-editor-commands"
last-updated: "2026-09-09"
---

# DroppyMarkdownEditorCommands

A handle onto the host editor's command bus (DroppyKit 0.2.2).

`@MainActor final class DroppyMarkdownEditorCommands`

A droplet creates one, hands it to [`DroppyMarkdownEditor`](https://getdroppy.app/docs/droppykit/api/droppy-markdown-editor) through [`DroppyMarkdownEditorContext`](https://getdroppy.app/docs/droppykit/api/droppy-markdown-editor-context), and calls `apply(_:)` from its toolbar buttons. Before the editor mounts, and in any host that supplies no editor, every call is a no-op rather than an error: a formatting button that cannot act yet is a cosmetic problem, not one worth throwing over.

## Initializers

### init()

`@MainActor init()`

Creates an unbound command bus.

## Properties

### hostRefreshFormatting

`@MainActor var hostRefreshFormatting: (() -> Void)?`

Bound by the host when the editor mounts, cleared on dismantle. Droplets never assign this.

### hostResign

`@MainActor var hostResign: (() -> Void)?`

Bound by the host when the editor mounts, cleared on dismantle. Droplets never assign this.

### hostSink

`@MainActor var hostSink: ((DroppyMarkdownToolbarAction) -> Void)?`

Bound by the host when the editor mounts, cleared on dismantle. Droplets never assign this.

## Methods

### apply(_:)

`@MainActor func apply(_ action: DroppyMarkdownToolbarAction)`

Applies a formatting command to the bound editor.

### refreshFormatting()

`@MainActor func refreshFormatting()`

Re-runs the markdown formatter without a text change, so existing `==spans==` recolor live after a pen change.

### resign()

`@MainActor func resign()`

Resigns first responder. Used when a title field takes focus.
