Перейти к содержимому
ФреймворкJavaScript

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

Оборачивает выделенный текст в <strong>. Включается сочетанием Cmd/Ctrl+B или кнопкой B на строчной панели инструментов. Поддерживает вложенные полужирные диапазоны и нормализует перекрывающуюся разметку при вставке.

Импорт

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

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

TypeScript
// No separate data shape. Bold is a mark on a run of the block's text field:
// { "text": "world", "marks": { "bold": true } }
JSON
// Inline tools affect the text field of the containing block.
// A paragraph with bold text:
{
  "type": "paragraph",
  "data": {
    "text": [{ "text": "Hello " }, { "text": "world", "marks": { "bold": true } }]
  }
}

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

TypeScript
import { Blok } from '@bloklabs/core';
import { Bold, 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,
    bold: Bold,
    // or with a shortcut override:
    // bold: { class: Bold, shortcut: 'CMD+SHIFT+B' },
  },
});