Skip to content
FrameworkJavaScript

Saver API: serialize the editor to JSON

Save and export editor content.

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

saver.save()

Promise<OutputData>

Alias for the main save() method.

When to use

Identical to editor.save(); provided for code that works through the saver module. Both await the full block tree.

TypeScript
const data = await editor.saver.save();
// Returns: { version, time, blocks }