@kodaeditor/core 1.0.0 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/docx-import.d.ts +11 -11
  2. package/dist/editor.d.ts +109 -159
  3. package/dist/fallback.d.ts +7 -8
  4. package/dist/i18n.d.ts +15 -26
  5. package/dist/import-formats.d.ts +19 -17
  6. package/dist/index.d.ts +4 -4
  7. package/dist/kodaeditor-core.umd.cjs +1 -1
  8. package/dist/kodaeditor.js +1 -1
  9. package/dist/kodaeditor.umd.cjs +1 -1
  10. package/dist/license.d.ts +46 -50
  11. package/dist/schema.d.ts +7 -7
  12. package/dist/serialize.d.ts +11 -11
  13. package/dist/web-component.d.ts +80 -189
  14. package/package.json +4 -6
  15. package/dist/commands.d.ts +0 -15
  16. package/dist/docx-alignment.d.ts +0 -14
  17. package/dist/docx-breaks.d.ts +0 -31
  18. package/dist/docx-forms.d.ts +0 -28
  19. package/dist/docx-headers.d.ts +0 -22
  20. package/dist/docx-images.d.ts +0 -41
  21. package/dist/docx-math.d.ts +0 -18
  22. package/dist/docx-styles.d.ts +0 -53
  23. package/dist/docx-symbols.d.ts +0 -19
  24. package/dist/docx-text-styles.d.ts +0 -27
  25. package/dist/floatingToolbar.d.ts +0 -7
  26. package/dist/group-icons.d.ts +0 -17
  27. package/dist/icons.d.ts +0 -1
  28. package/dist/image-view.d.ts +0 -27
  29. package/dist/markdown.d.ts +0 -4
  30. package/dist/menubar.d.ts +0 -60
  31. package/dist/offline-license.d.ts +0 -36
  32. package/dist/pagination.d.ts +0 -11
  33. package/dist/paste.d.ts +0 -54
  34. package/dist/pdf-import-cdn.d.ts +0 -2
  35. package/dist/pdf-import.d.ts +0 -8
  36. package/dist/print.d.ts +0 -18
  37. package/dist/rtf-images.d.ts +0 -24
  38. package/dist/search.d.ts +0 -17
  39. package/dist/slashMenu.d.ts +0 -8
  40. package/dist/styles.d.ts +0 -8
  41. package/dist/table-split.d.ts +0 -26
  42. package/dist/table-view.d.ts +0 -34
  43. package/dist/tableColumnTrade.d.ts +0 -15
  44. package/dist/tableToolbar.d.ts +0 -14
  45. package/dist/toc-view.d.ts +0 -23
  46. package/dist/toolbar-editor.d.ts +0 -89
  47. package/dist/validate-signature.d.ts +0 -64
  48. package/dist/xlsx-import-cdn.d.ts +0 -1
  49. package/dist/xlsx-import.d.ts +0 -2
@@ -4,9 +4,9 @@ export interface DocxImportResult {
4
4
  }
5
5
  export type DocxImportErrorCode = 'corrupt' | 'invalid' | 'parse';
6
6
  /**
7
- * Ошибка импорта с готовым к показу пользователю сообщением (поле
8
- * `userMessage`) и машинным кодом причины. UI показывает `userMessage`,
9
- * а не сырой текст исключения движка.
7
+ * An import failure carrying a message fit to show the user
8
+ * (`userMessage`) alongside a machine-readable reason code. Show
9
+ * `userMessage` rather than the raw exception text from the converter.
10
10
  */
11
11
  export declare class DocxImportError extends Error {
12
12
  readonly code: DocxImportErrorCode;
@@ -14,23 +14,23 @@ export declare class DocxImportError extends Error {
14
14
  constructor(code: DocxImportErrorCode, userMessage: string, cause?: unknown);
15
15
  }
16
16
  /**
17
- * Классифицирует сырое исключение движка/zip-распаковщика в код причины и
18
- * человекочитаемое сообщение (RU). Чистая функция — тестируется отдельно.
17
+ * Classifies a raw exception from the converter or the zip reader into a
18
+ * reason code and a readable message. A pure function.
19
19
  */
20
20
  export declare function classifyDocxError(message: string): {
21
21
  code: DocxImportErrorCode;
22
22
  userMessage: string;
23
23
  };
24
24
  /**
25
- * Превращает голый текст (аварийный fallback, когда богатый разбор упал) в
26
- * минимальный безопасный HTML: непустые строки -> абзацы, с экранированием.
27
- * Чистая функция — тестируется отдельно.
25
+ * Turns plain text into minimal, escaped HTML - non-empty lines become
26
+ * paragraphs. Used as a last resort when the rich conversion fails, so that
27
+ * the user gets their text rather than an error. A pure function.
28
28
  */
29
29
  export declare function rawTextToHtml(text: string): string;
30
30
  /**
31
- * Конвертирует .docx (File или ArrayBuffer) в чистый HTML для редактора.
32
- * Картинки приходят как data-URI (base64) и сохраняются в документе.
31
+ * Converts a .docx (File or ArrayBuffer) into clean HTML for the editor.
32
+ * Images arrive as data URIs and are kept in the document.
33
33
  *
34
- * Бросает {@link DocxImportError}, если файл невозможно открыть даже как текст.
34
+ * Throws {@link DocxImportError} if the file cannot be opened even as text.
35
35
  */
36
36
  export declare function importDocxToHtml(source: File | ArrayBuffer): Promise<DocxImportResult>;
package/dist/editor.d.ts CHANGED
@@ -3,26 +3,26 @@ import { type ImportFormat } from './import-formats';
3
3
  import { type DocxImportResult } from './docx-import';
4
4
  import { type Strings } from './i18n';
5
5
  export interface EditorOptions {
6
- /** Контейнер, в который монтируется редактор. */
6
+ /** Element the editor mounts into. */
7
7
  element: HTMLElement;
8
- /** Начальный HTML-контент. */
8
+ /** Initial HTML content. */
9
9
  content?: string;
10
- /** Подсказка, когда документ пуст. */
10
+ /** Placeholder shown while the document is empty. */
11
11
  placeholder?: string;
12
- /** Доступное имя для скринридеров (ARIA). */
12
+ /** Accessible name for screen readers (ARIA). */
13
13
  ariaLabel?: string;
14
- /** Локализованные строки UI (для slash-меню и floating-тулбара). */
14
+ /** Localised interface strings, used by the slash menu and floating toolbar. */
15
15
  strings?: Strings;
16
- /** Колбэк при каждом изменении документа. */
16
+ /** Called on every change to the document. */
17
17
  onChange?: (html: string) => void;
18
- /** Колбэки для плавающей панели таблицы (открыть диалог вместо «голой» команды). */
18
+ /** Hooks for the floating table toolbar, so a host can open its own dialog. */
19
19
  tableCallbacks?: {
20
20
  onSplitCell?: () => void;
21
21
  onMergeCells?: () => void;
22
22
  };
23
23
  }
24
24
  declare const schema: import("prosemirror-model").Schema<keyof import("orderedmap").default<import("prosemirror-model").NodeSpec>, keyof import("orderedmap").default<import("prosemirror-model").MarkSpec>>;
25
- /** Свойства ячейки таблицы (диалог «Свойства ячейки»). */
25
+ /** Table cell properties, as edited in the cell properties dialog. */
26
26
  export interface CellProps {
27
27
  background?: string;
28
28
  textAlign?: string;
@@ -30,7 +30,7 @@ export interface CellProps {
30
30
  borderWidth?: number;
31
31
  borderColor?: string;
32
32
  }
33
- /** Свойства таблицы (диалог «Свойства таблицы»). */
33
+ /** Table properties, as edited in the table properties dialog. */
34
34
  export interface TableProps {
35
35
  width?: string;
36
36
  align?: string;
@@ -40,26 +40,8 @@ export interface TableProps {
40
40
  export declare class Editor {
41
41
  readonly view: EditorView;
42
42
  private readonly onChange?;
43
- /**
44
- * Подтверждена ли лицензия. Влияет ТОЛЬКО на пометку в выгрузках - ничего
45
- * не отключает и не блокирует: принцип «деградация, а не блокировка»
46
- * остаётся, редактор работает целиком в любом случае.
47
- */
48
43
  private licensed;
49
- /**
50
- * Промис идущей проверки лицензии. Нужен потому, что licensed стартует с
51
- * false, а решение приходит только после сети: без ожидания ЛЮБАЯ выгрузка
52
- * в первые секунды после монтирования уносила бы ознакомительную пометку в
53
- * документ оплатившего клиента. Окно тем шире, чем хуже наша связь - до 6
54
- * секунд при недоступном сервере лицензий, - и сценарий «открыл документ,
55
- * нажал Печать» в него укладывается, а маршрут вида /print/:id в
56
- * хост-приложении попадает туда почти всегда.
57
- *
58
- * Обратное решение (считать лицензию действующей до ответа) не годится: оно
59
- * дало бы неоплатившим повторяемое окно чистых выгрузок.
60
- */
61
44
  private licenseCheck;
62
- /** Строки интерфейса - нужны для текста пометки на языке пользователя. */
63
45
  private readonly strings;
64
46
  private placeholderText;
65
47
  private premiumPaste;
@@ -70,151 +52,129 @@ export declare class Editor {
70
52
  private readonly trackState;
71
53
  private readonly paginationState;
72
54
  constructor(opts: EditorOptions);
73
- /** Текущий документ как чистый HTML. */
55
+ /** The current document as plain HTML. */
74
56
  getHTML(): string;
75
57
  /**
76
- * Заменить содержимое из HTML-строки.
58
+ * Replaces the content with the given HTML.
77
59
  *
78
- * Через транзакцию, а не пересозданием state, чтобы сохранить историю
79
- * undo/redo - иначе Ctrl+Z после программной установки молча не работает.
60
+ * Applied as a transaction rather than by recreating the state, so the
61
+ * undo history survives - otherwise Ctrl+Z after a programmatic write
62
+ * would silently do nothing.
80
63
  */
81
64
  setHTML(html: string): void;
82
65
  /**
83
- * Импорт файла .docx прямо в редактор. Возвращает предупреждения движка
84
- * (неподдержанные стили и т.п.) - UI может их показать или проигнорировать.
66
+ * Imports a .docx straight into the editor and returns the converter's
67
+ * warnings, such as unsupported styles. Show them or ignore them.
85
68
  */
86
69
  importDocx(source: File | ArrayBuffer): Promise<DocxImportResult>;
87
- /** Вставляет HTML в позицию курсора (НЕ заменяя весь документ). */
70
+ /** Inserts HTML at the cursor, leaving the rest of the document alone. */
88
71
  insertHtmlAtCursor(html: string): void;
89
72
  /**
90
- * Единый импорт файла: детект типа -> нужный обработчик. .docx ОТКРЫВАЕТ
91
- * (заменяет документ); картинка/CSV/txt ВСТАВЛЯЮТСЯ в курсор. Бросает для
92
- * неподдержанного типа. Точка подключения для кнопки/drag-drop/paste.
73
+ * One entry point for any file: the type is detected and routed. A .docx
74
+ * OPENS, replacing the document; an image, CSV or text file is INSERTED at
75
+ * the cursor. Throws on an unsupported type. This is what a toolbar button,
76
+ * a drag-and-drop handler or a paste handler should call.
93
77
  */
94
78
  importFile(file: File): Promise<ImportFormat>;
95
- /** Импорт PDF как картинок: каждая страница -> PNG, вставляется в документ. */
79
+ /** Imports a PDF as images: each page becomes a PNG inserted into the document. */
96
80
  importPdfAsImages(file: File): Promise<void>;
97
81
  /**
98
- * Импорт PDF «как есть»: встраивает сам файл (data-URL) блоком-iframe.
99
- * Полностью client-side, на сервер не уходит. Просмотр - встроенным
100
- * PDF-вьюером браузера; редактировать содержимое нельзя (atom-узел).
82
+ * Embeds a PDF as it is, as an iframe holding the file itself. Entirely
83
+ * client-side - nothing is uploaded. The browser's own PDF viewer renders
84
+ * it; its contents cannot be edited.
101
85
  */
102
86
  importPdfAsEmbed(file: File): Promise<void>;
103
- /** Хост задаёт спрашивалку режима PDF (текст/картинки/встроить). */
87
+ /** Lets the host decide how a PDF is inserted: as text, as images or embedded. */
104
88
  setPdfModeResolver(fn: () => Promise<'text' | 'images' | 'embed' | null>): void;
105
89
  /**
106
- * Импорт PDF с выбором режима, если хост задал резолвер (drag-drop, буфер).
107
- * Без резолвера - поведение по умолчанию (текст), как раньше.
90
+ * Imports a PDF, asking the host for the mode when it provided a resolver
91
+ * (used by drag-and-drop and paste). Without one, text is used.
108
92
  */
109
93
  importPdfWithChoice(file: File): Promise<void>;
110
94
  /**
111
- * Вставка «богатого» буфера, полученного из companion-расширения в обход
112
- * браузерной песочницы: на вход полный сырой HTML + RTF (с встроенными
113
- * картинками). Прогоняем тот же премиум-пайплайн и вставляем в курсор.
95
+ * Pastes rich clipboard content captured by the companion extension, which
96
+ * can read what the page sandbox cannot: the full raw HTML plus RTF with
97
+ * embedded images. It goes through the same cleanup pipeline as a normal
98
+ * paste and is inserted at the cursor.
114
99
  */
115
100
  pasteRich(html: string, rtf?: string): void;
116
101
  /**
117
- * Сменить подсказку пустого документа на лету. Нужна хосту: атрибут
118
- * placeholder заявлен в observedAttributes веб-компонента, и до этого
119
- * изменение атрибута молча ничего не делало - подсказка была вшита в
120
- * плагин при создании редактора.
102
+ * Changes the empty-document placeholder at runtime. The web component
103
+ * needs this: `placeholder` is a watched attribute, and changing it has to
104
+ * take effect rather than silently do nothing.
121
105
  */
122
106
  setPlaceholder(text: string): void;
123
- /** Сменить доступное имя области ввода (атрибут aria-label у хоста). */
107
+ /** Changes the accessible name of the editing area (the host's aria-label). */
124
108
  setAriaLabel(label: string): void;
125
- /** Документ как JSON (для хранения в БД без потери структуры). */
109
+ /** The document as JSON, for storing in a database without losing structure. */
126
110
  getJSON(): Record<string, unknown>;
127
- /** Пустой ли документ (нет текстового содержимого). */
111
+ /** Whether the document has no text content. */
128
112
  isEmpty(): boolean;
129
- /** Включает/выключает премиум smart-paste (по лицензии). */
113
+ /** Turns the licensed smart-paste pipeline on or off. */
130
114
  /**
131
- * Отметить лицензию подтверждённой. Ставит хост после проверки (valid или
132
- * grace). До этого выгрузки несут ознакомительную пометку.
115
+ * Marks the license as confirmed. The host sets this after validation
116
+ * succeeds, or while the grace period is in effect. Until then every export
117
+ * carries the trial mode line.
133
118
  */
134
119
  setLicensed(on: boolean): void;
135
- /**
136
- * Ознакомительная пометка в ВЫГРУЗКАХ.
137
- *
138
- * Зачем она нужна отдельно от знака на экране: знак видит тот, кто работает
139
- * в редакторе, а платит не он. Пометка же уходит туда, где продукт отдаёт
140
- * ценность наружу - в договор, счёт, отчёт, которые компания отправляет
141
- * своему клиенту. Отправить такой документ со строкой об ознакомительном
142
- * режиме нельзя, и это делает работу без лицензии невозможной по деловым
143
- * причинам, а не по техническим.
144
- *
145
- * Что при этом НЕ делается: ничего не отключается, экспорт работает
146
- * полностью, файл открывается и читается. Деградация, а не блокировка.
147
- *
148
- * Честно: снять это со стороны страницы по-прежнему можно - код исполняется
149
- * у клиента. Барьер остаётся юридическим, пометка лишь делает нарушение
150
- * видимым тому, кому документ придёт.
151
- */
152
120
  private trialNotice;
153
- /** Пометка для текстовых форматов (txt, md, csv): отдельной строкой в конце. */
154
121
  private appendTrialText;
155
- /** Пометка для HTML-подобных форматов: абзацем в конце документа. */
156
122
  private appendTrialHtml;
157
123
  setPremiumPaste(on: boolean): void;
158
- /** Следующая вставка - только текст (для кнопки тулбара). */
124
+ /** Makes the next paste plain text only, for the toolbar button. */
159
125
  armPlainPaste(): void;
160
126
  /**
161
- * Передаёт редактору промис идущей проверки лицензии. Вызывает web-компонент
162
- * сразу после монтирования; при использовании ядра напрямую промиса нет и
163
- * поведение прежнее.
127
+ * Hands the editor the promise of the validation request in flight. The web
128
+ * component does this right after mounting; when the core is used directly
129
+ * there is no promise and behaviour is unchanged.
164
130
  */
165
131
  setLicenseCheck(p: Promise<unknown>): void;
166
- /**
167
- * Ждёт решения по лицензии перед выгрузкой. Потолок 7 секунд - чуть больше
168
- * сетевого таймаута самой проверки (6 с), то есть в норме мы упираемся в её
169
- * собственный таймаут, а не в этот. Потолок здесь на случай проверки, которая
170
- * по какой-то причине не завершилась вовсе: выгрузка не должна зависнуть.
171
- */
172
132
  private licenseSettled;
173
133
  /**
174
- * Экспорт документа в PDF средствами браузера (печать). Client-side:
175
- * содержимое не уходит на сервер (важно для ЭДО), рендер браузерный = WYSIWYG.
134
+ * Exports to PDF through the browser print dialog. Client-side: the content
135
+ * never leaves the machine, and what you see is what gets printed.
176
136
  */
177
137
  exportPdf(): Promise<void>;
178
- /** Экспорт документа в Markdown (скачивание .md). Client-side. */
138
+ /** Exports to Markdown and downloads the .md file. Runs in the browser. */
179
139
  exportMarkdown(): Promise<void>;
180
- /** Экспорт в самодостаточный HTML-файл (.html). Client-side. */
140
+ /** Exports to a self-contained .html file. Runs in the browser. */
181
141
  exportHtml(): Promise<void>;
182
- /** Экспорт в простой текст (.txt). Client-side. */
142
+ /** Exports to plain text (.txt). Runs in the browser. */
183
143
  exportText(): Promise<void>;
184
- /** Экспорт таблиц документа в CSV (.csv). Client-side. */
144
+ /** Exports the document's tables to CSV. Runs in the browser. */
185
145
  exportCsv(): Promise<void>;
186
- /** Экспорт в Word (.doc - Word-совместимый HTML). Client-side, без библиотек. */
146
+ /** Exports to Word (.doc, Word-compatible HTML). Runs in the browser, no libraries. */
187
147
  exportWord(): Promise<void>;
188
148
  focus(): void;
189
- /** Текущее состояние поиска для UI: всего совпадений и номер активного (1-based). */
149
+ /** Current search state: total matches and the index of the active one, from 1. */
190
150
  searchInfo(): {
191
151
  count: number;
192
152
  current: number;
193
153
  };
194
154
  private scrollToActiveMatch;
195
- /** Задать поисковый запрос (подсветит все совпадения, перейдёт к первому). */
155
+ /** Sets the search query, highlights every match and jumps to the first. */
196
156
  setSearchQuery(query: string): {
197
157
  count: number;
198
158
  current: number;
199
159
  };
200
- /** К следующему совпадению (с циклом). */
160
+ /** Moves to the next match, wrapping around. */
201
161
  searchNext(): {
202
162
  count: number;
203
163
  current: number;
204
164
  };
205
- /** К предыдущему совпадению (с циклом). */
165
+ /** Moves to the previous match, wrapping around. */
206
166
  searchPrev(): {
207
167
  count: number;
208
168
  current: number;
209
169
  };
210
- /** Заменить активное совпадение. */
170
+ /** Replaces the active match. */
211
171
  replaceCurrentMatch(replacement: string): {
212
172
  count: number;
213
173
  current: number;
214
174
  };
215
- /** Заменить все совпадения. Возвращает число замен. */
175
+ /** Replaces every match and returns how many were replaced. */
216
176
  replaceAll(replacement: string): number;
217
- /** Сбросить поиск (убрать подсветку). */
177
+ /** Clears the search and removes the highlighting. */
218
178
  clearSearch(): void;
219
179
  destroy(): void;
220
180
  private run;
@@ -222,8 +182,8 @@ export declare class Editor {
222
182
  setHeading(level: number): void;
223
183
  setParagraph(): void;
224
184
  /**
225
- * Применить стиль из галереи (система стилей): тип блока + интервалы одним
226
- * действием. blockquote оборачивает; heading/paragraph меняют тип с атрибутами.
185
+ * Applies a style from the gallery: block type and spacing in one action.
186
+ * A blockquote wraps the selection; headings and paragraphs change type.
227
187
  */
228
188
  applyBlockStyle(style: {
229
189
  type: 'paragraph' | 'heading' | 'blockquote';
@@ -233,140 +193,130 @@ export declare class Editor {
233
193
  toggleBulletList(): void;
234
194
  toggleOrderedList(): void;
235
195
  wrapBlockquote(): void;
236
- /** Выделить весь документ (для пункта меню «Выделить всё»). */
196
+ /** Selects the whole document. */
237
197
  selectAll(): void;
238
- /** Пустое ли выделение (каретка без диапазона). */
198
+ /** Whether the selection is empty, i.e. a caret with no range. */
239
199
  isSelectionEmpty(): boolean;
240
200
  private copiedMarks;
241
- /** Запомнить форматирование текущей позиции (для «кисти формата»). */
201
+ /** Copies the formatting at the cursor, for the format painter. */
242
202
  copyFormat(): void;
243
203
  hasCopiedFormat(): boolean;
244
- /** Применить запомненное форматирование к выделению (заменяет инлайн-формат). */
204
+ /** Applies the copied formatting to the selection, replacing inline formatting. */
245
205
  applyCopiedFormat(): void;
246
206
  setCodeBlock(): void;
247
- /** Применить марку с атрибутами к выделению (или к будущему вводу, если пусто). */
248
207
  private applyAttrMark;
249
208
  private clearAttrMark;
250
- /**
251
- * Безопасно ли CSS-значение для подстановки в одно объявление style:
252
- * запрещаем выход из объявления (`;{}`), HTML-брейкаут (`<>`) и опасные
253
- * CSS-функции (url(), expression(), @import, комментарии). Защита от
254
- * хранимой CSS-инъекции, если в сеттер передадут недоверенную строку.
255
- */
256
209
  private safeCss;
257
- /** Размер шрифта, напр. "16px" (пусто - сбросить; невалидное - игнор). */
210
+ /** Font size, e.g. "16px". Empty clears it; an invalid value is ignored. */
258
211
  setFontSize(size: string): void;
259
- /** Семейство шрифта (пусто - сбросить; невалидное - игнор). */
212
+ /** Font family. Empty clears it; an invalid value is ignored. */
260
213
  setFontFamily(family: string): void;
261
- /** Цвет текста (пусто - сбросить; невалидное - игнор). */
214
+ /** Text colour. Empty clears it; an invalid value is ignored. */
262
215
  setTextColor(color: string): void;
263
- /** Выделение фоном (пусто - снять; невалидное - игнор). */
216
+ /** Highlight colour. Empty removes it; an invalid value is ignored. */
264
217
  setHighlight(color: string): void;
265
- /** Снять всё инлайн-форматирование в выделении (или у каретки - отложенные марки). */
218
+ /** Clears all inline formatting in the selection, or the pending marks at the caret. */
266
219
  clearFormatting(): void;
267
- /** Поставить/заменить ссылку на выделении (пусто - вставить URL текстом). */
220
+ /** Sets or replaces a link on the selection; with no selection the URL is inserted as text. */
268
221
  setLink(href: string): void;
269
- /** Снять ссылку с выделения. */
222
+ /** Removes the link from the selection. */
270
223
  unsetLink(): void;
271
- /** Текущее значение атрибута марки у каретки (для отражения в выпадашке). */
224
+ /** The mark attribute currently in effect at the caret, for reflecting in a dropdown. */
272
225
  currentMarkAttr(name: keyof typeof schema.marks, attr: string): string | null;
273
- /** Текущий блочный стиль: 'paragraph' | 'h1'..'h6' | 'blockquote'. */
226
+ /** The current block style: 'paragraph', 'h1' to 'h6', or 'blockquote'. */
274
227
  currentBlock(): string;
275
- /** Выравнивание текущих абзацев/заголовков. */
228
+ /** Alignment of the current paragraphs or headings. */
276
229
  setAlign(align: string): void;
277
- /** Активно ли выравнивание (для подсветки кнопок). */
230
+ /** Whether that alignment is active, for highlighting toolbar buttons. */
278
231
  isAlignActive(align: string): boolean;
279
- /** Вставить изображение по src (URL, путь или data-URI). */
232
+ /** Inserts an image by src: a URL, a path or a data URI. */
280
233
  insertImage(src: string, alt?: string): void;
281
- /** Вставить поле шаблона (merge field) - inline-чип для подстановки реквизита ЭДО. */
234
+ /** Inserts a merge field: an inline chip replaced by a real value later. */
282
235
  insertMergeField(key: string, label?: string): void;
283
236
  /**
284
- * HTML документа с полями шаблона, развёрнутыми в плейсхолдеры {{key}} -
285
- * для ЭДО-систем, которые подставляют значения по {{...}}, а не по
286
- * data-атрибутам. Без аргумента берёт текущий документ.
237
+ * The document's HTML with merge fields expanded to {{key}} placeholders,
238
+ * for systems that substitute values by {{...}} rather than by data
239
+ * attributes. With no argument it uses the current document.
287
240
  */
288
241
  getMergeText(html?: string): string;
289
- /** Вставить сноску с текстом (надстрочный номер; нумерация - авто). */
242
+ /** Inserts a footnote with the given text; the superscript number is assigned automatically. */
290
243
  insertFootnote(text: string): void;
291
- /** Тексты всех сносок документа по порядку (для секции сносок при печати/экспорте). */
244
+ /** The text of every footnote, in document order, for the notes section when printing or exporting. */
292
245
  getFootnotes(): string[];
293
- /** Вставить блок оглавления (наполняется заголовками автоматически). */
246
+ /** Inserts a table of contents, filled from the document's headings. */
294
247
  insertTableOfContents(): void;
295
248
  private commentSeq;
296
- /** Добавить комментарий к выделению; возвращает id (или null, если нет выделения/текста). */
249
+ /** Adds a comment on the selection and returns its id, or null if there is no selected text. */
297
250
  addComment(text: string, author?: string): string | null;
298
- /** Все комментарии документа (по первому появлению), в порядке текста. */
251
+ /** Every comment in the document, in the order the text appears. */
299
252
  getComments(): {
300
253
  id: string;
301
254
  text: string;
302
255
  author: string | null;
303
256
  }[];
304
- /** Снять (разрешить) комментарий по id - убирает подсветку с текста. */
257
+ /** Resolves a comment by id, removing its highlight from the text. */
305
258
  resolveComment(id: string): void;
306
- /** Комментарии под кареткой/выделением (для всплывающего попапа). */
259
+ /** Comments at the caret or selection, for a popup. */
307
260
  commentsAtSelection(): {
308
261
  id: string;
309
262
  text: string;
310
263
  author: string | null;
311
264
  }[];
312
- /** Включить/выключить режим рецензирования (новый текст помечается как вставка). */
265
+ /** Turns track changes on or off; new text is then marked as an insertion. */
313
266
  setTrackChanges(on: boolean): void;
314
267
  isTrackingChanges(): boolean;
315
- /** Включить/выключить страничный вид (границы страниц A4). */
268
+ /** Turns the page view on or off, showing A4 page boundaries. */
316
269
  setPagination(on: boolean): void;
317
270
  isPaginated(): boolean;
318
- /** Предложить удаление выделенного текста (зачёркивается, не удаляется). */
271
+ /** Suggests deleting the selected text: it is struck through, not removed. */
319
272
  markDeletion(): void;
320
- /** Диапазоны помеченных правок (текстовые узлы с insertion/deletion). */
321
273
  private collectChangeRanges;
322
- /** Кол-во предложенных правок (для UI). */
274
+ /** How many suggested changes the document holds. */
323
275
  getChangeCount(): {
324
276
  insertions: number;
325
277
  deletions: number;
326
278
  };
327
- /** Принять все правки: вставки остаются (снимаем метку), удаления применяются. */
279
+ /** Accepts every change: insertions lose their marks, deletions are applied. */
328
280
  acceptAllChanges(): void;
329
- /** Отклонить все правки: вставки удаляются, удаления отменяются (текст остаётся). */
281
+ /** Rejects every change: insertions are removed, deletions are undone. */
330
282
  rejectAllChanges(): void;
331
- /** Вставить горизонтальную линию (<hr>) в позицию курсора. */
283
+ /** Inserts a horizontal rule at the cursor. */
332
284
  insertHorizontalRule(): void;
333
285
  insertTable(rows?: number, cols?: number): void;
334
286
  tableAddRow(): void;
335
287
  tableAddColumn(): void;
336
288
  tableDeleteRow(): void;
337
289
  tableDeleteColumn(): void;
338
- /** Объединить выделенные ячейки (нужно выделение нескольких ячеек). */
290
+ /** Merges the selected cells; more than one cell must be selected. */
339
291
  tableMergeCells(): void;
340
292
  /**
341
- * Разделить ячейку. С аргументами (cols, rows) - Word-режим: делит одиночную
342
- * ячейку на сетку cols×rows. Без аргументов или для уже объединённой ячейки -
343
- * встроенный splitCell (разъединяет обратно в 1×1).
293
+ * Splits a cell. With (cols, rows) it behaves like Word and splits a single
294
+ * cell into that grid. Without arguments, or on an already merged cell, it
295
+ * splits it back into single cells.
344
296
  */
345
297
  tableSplitCell(cols?: number, rows?: number): void;
346
- /** Можно ли разъединить текущую ячейку (она объединена: colspan/rowspan > 1). */
298
+ /** Whether the current cell can be split, i.e. it spans more than one column or row. */
347
299
  isMergedCell(): boolean;
348
- /** Выделено ли 2+ ячейки (CellSelection охватывает несколько ячеек). */
300
+ /** Whether two or more cells are selected. */
349
301
  hasMultiCellSelection(): boolean;
350
302
  tableDelete(): void;
351
- /** Найти таблицу, охватывающую текущее выделение. */
352
303
  private findCurrentTable;
353
- /** Применить колбэк к каждой выделенной ячейке (или текущей, если выделения ячеек нет). */
354
304
  private forEachSelectedCell;
355
- /** Свойства текущей ячейки - для предзаполнения диалога. */
305
+ /** Properties of the current cell, for pre-filling a dialog. */
356
306
  getCellProps(): CellProps;
357
- /** Применить свойства к выделенным ячейкам. */
307
+ /** Applies properties to the selected cells. */
358
308
  setCellProps(props: CellProps): void;
359
- /** Свойства текущей таблицы - для предзаполнения диалога. */
309
+ /** Properties of the current table, for pre-filling a dialog. */
360
310
  getTableProps(): TableProps;
361
- /** Применить свойства к таблице (ширина/выравнивание) и, опционально, рамку ко всем ячейкам. */
311
+ /** Applies width and alignment to the table, and optionally a border to every cell. */
362
312
  setTableProps(props: TableProps): void;
363
- /** В таблице ли сейчас курсор (для активации пунктов «Свойства…»). */
313
+ /** Whether the cursor is inside a table, for enabling the properties menu items. */
364
314
  isInTable(): boolean;
365
315
  undo(): void;
366
316
  redo(): void;
367
- /** Активна ли марка в текущем выделении (для подсветки кнопок). */
317
+ /** Whether a mark is active in the current selection, for highlighting buttons. */
368
318
  isMarkActive(name: keyof typeof schema.marks): boolean;
369
- /** Является ли текущий блок узлом данного типа (для подсветки H1/H2/абзаца). */
319
+ /** Whether the current block is of the given type, for highlighting H1, H2 or paragraph. */
370
320
  isNodeType(name: string, attrs?: Record<string, unknown>): boolean;
371
321
  }
372
322
  export {};
@@ -1,13 +1,12 @@
1
1
  /**
2
- * Деградация для старых браузеров.
2
+ * Graceful degradation for old browsers.
3
3
  *
4
- * Корпоративное требование — «не ломаться». На современных браузерах работает
5
- * полноценный редактор (Web Component + Shadow DOM). Если браузер их не
6
- * поддерживает (очень старые версии), вместо редактора показывается обычная
7
- * textarea: ввод работает, формы получают значение, продукт не падает белым
8
- * экраном.
4
+ * Modern browsers get the full editor, built on a web component and shadow
5
+ * DOM. Where those are not supported, a plain textarea is shown instead:
6
+ * typing works, forms still receive the value, and nothing greets the user
7
+ * with a blank screen.
9
8
  */
10
- /** Поддерживает ли браузер полноценный редактор. */
9
+ /** Whether this browser can run the full editor. */
11
10
  export declare function supportsModernEditor(): boolean;
12
- /** Заменяет все <koda-editor> на textarea (режим деградации). */
11
+ /** Replaces every <koda-editor> with a textarea. */
13
12
  export declare function installFallback(tag?: string): void;