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

Код в строке: моноширинные фрагменты

Wraps selected text in `<code>`. Activated with Cmd/Ctrl+E or by clicking the code button in the inline toolbar. Useful for marking up variable names, function calls, and short code snippets within text.

Импорт

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

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

TypeScript
// Stored as HTML inside the block's text field.
// "Call <code>getData()</code> to fetch results"
JSON
{
  "type": "paragraph",
  "data": { "text": "Call <code>getData()</code> to fetch results" }
}

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

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

const editor = new Blok({
  holder: 'editor',
  tools: {
    inlineCode: InlineCode,
  },
});