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

Жирный: сильное выделение текста

Wraps selected text in `<strong>`. Activated with Cmd/Ctrl+B or by clicking the B button in the inline toolbar. Supports nested bold ranges and normalises overlapping markup on paste.

Импорт

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

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

TypeScript
// No separate data shape — Bold is stored as HTML inside the block's text field.
// Example HTML stored in a paragraph:
// "Hello <strong>world</strong>"
JSON
// Inline tools affect the text field of the containing block.
// A paragraph with bold text:
{
  "type": "paragraph",
  "data": { "text": "Hello <strong>world</strong>" }
}

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

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

const editor = new Blok({
  holder: 'editor',
  tools: {
    bold: Bold,
    // or with shortcut override:
    // bold: { class: Bold },
  },
});