Skip to content
ФреймворкJavaScript

Сбросить формат: снять строчное оформление

Removes inline formatting (bold, italic, underline, strikethrough, inline code, highlight) from the selected text while keeping links intact. Activated with Cmd/Ctrl+\ or by clicking the Tx button in the inline toolbar.

Импорт

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

Формат данных

TypeScript
// Removes formatting tags from the block's text field.
// "<b>Hello</b> world" becomes "Hello world"
JSON
{
  "type": "paragraph",
  "data": { "text": "Hello world" }
}

Пример использования

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

const editor = new Blok({
  holder: 'editor',
  tools: {
    clearFormat: ClearFormat,
  },
});