Skip to content
FrameworkJavaScript

Clear format: strip inline styling

Removes inline formatting (bold, italic, underline, strikethrough, inline code, highlight) from the selected text. Links stay intact. Apply it by clicking the Tx button in the inline toolbar.

Import

TypeScript
import { ClearFormat } from '@bloklabs/core/tools';

Save Data

TypeScript
// Removes marks from the runs of the block's text field.
// [{ "text": "Hello", "marks": { "bold": true } }, { "text": " world" }]
// becomes [{ "text": "Hello world" }]
JSON
{
  "type": "paragraph",
  "data": { "text": [{ "text": "Hello world" }] }
}

Usage Example

TypeScript
import { Blok } from '@bloklabs/core';
import { ClearFormat, Paragraph } from '@bloklabs/core/tools';

const editor = new Blok({
  holder: 'editor',
  tools: {
    // Paragraph is the default block and is not bundled with the core —
    // without it the editor starts with an "unsupported block" stub.
    paragraph: Paragraph,
    clearFormat: ClearFormat,
  },
});