ФреймворкJavaScript
Индексы: надстрочный и подстрочный текст
Одна кнопка панели инструментов с поповером из двух вариантов. Она включает для выделения верхний (<sup>) или нижний (<sub>) индекс. Режимы взаимно исключают друг друга, поэтому применение одного снимает другой. Сочетания клавиш: Cmd/Ctrl+Period для верхнего индекса, Cmd/Ctrl+Comma для нижнего.
Импорт
TypeScript
import { SupSub } from '@bloklabs/core/tools';Формат данных
TypeScript
// A mark on a run of the block's text field:
// { "text": "2", "marks": { "sup": true } } or { "text": "2", "marks": { "sub": true } }JSON
{
"type": "paragraph",
"data": {
"text": [{ "text": "E = mc" }, { "text": "2", "marks": { "sup": true } }]
}
}Пример использования
TypeScript
import { Blok } from '@bloklabs/core';
import { Paragraph, SupSub } 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,
supSub: SupSub,
},
});