Skip to content
FrameworkJavaScript

Inline Toolbar API: control the formatting toolbar

Control the inline formatting toolbar (bold, italic, etc.).

Reaching the editor instance

The methods below run on the editor you created with new Blok(). They are available once editor.isReady resolves.

TypeScript
// You already hold the instance returned by the constructor.
const editor = new Blok({ holder: 'editor' });
await editor.isReady;

// Call any API method on it.
editor.caret.setToLastBlock('end');

Methods

inlineToolbar.close()

void

Close the inline toolbar.

When to use

Dismiss the formatting popover — useful after a custom inline tool applies its change.

TypeScript
editor.inlineToolbar.close();

inlineToolbar.open()

void

Open the inline toolbar at the current selection.

When to use

Show the formatting popover over the current selection; a no-op without selected text.

TypeScript
editor.inlineToolbar.open();