@kodaeditor/core 1.0.1 → 1.0.3
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.
- package/THIRD-PARTY-LICENSES.txt +83 -83
- package/dist/docx-import.d.ts +11 -11
- package/dist/editor.d.ts +109 -159
- package/dist/fallback.d.ts +7 -8
- package/dist/i18n.d.ts +15 -26
- package/dist/import-formats.d.ts +19 -17
- package/dist/index.d.ts +4 -4
- package/dist/kodaeditor-core.umd.cjs +1 -1
- package/dist/kodaeditor.js +1 -1
- package/dist/kodaeditor.umd.cjs +1 -1
- package/dist/license.d.ts +46 -50
- package/dist/schema.d.ts +7 -7
- package/dist/serialize.d.ts +11 -11
- package/dist/web-component.d.ts +71 -213
- package/package.json +2 -5
- package/dist/commands.d.ts +0 -15
- package/dist/docx-alignment.d.ts +0 -14
- package/dist/docx-breaks.d.ts +0 -31
- package/dist/docx-forms.d.ts +0 -28
- package/dist/docx-headers.d.ts +0 -22
- package/dist/docx-images.d.ts +0 -41
- package/dist/docx-math.d.ts +0 -18
- package/dist/docx-styles.d.ts +0 -53
- package/dist/docx-symbols.d.ts +0 -19
- package/dist/docx-text-styles.d.ts +0 -27
- package/dist/floatingToolbar.d.ts +0 -7
- package/dist/group-icons.d.ts +0 -17
- package/dist/icons.d.ts +0 -1
- package/dist/image-view.d.ts +0 -27
- package/dist/markdown.d.ts +0 -4
- package/dist/menubar.d.ts +0 -60
- package/dist/offline-license.d.ts +0 -36
- package/dist/pagination.d.ts +0 -11
- package/dist/paste.d.ts +0 -54
- package/dist/pdf-import-cdn.d.ts +0 -2
- package/dist/pdf-import.d.ts +0 -8
- package/dist/print.d.ts +0 -18
- package/dist/rtf-images.d.ts +0 -24
- package/dist/search.d.ts +0 -17
- package/dist/slashMenu.d.ts +0 -8
- package/dist/styles.d.ts +0 -8
- package/dist/table-split.d.ts +0 -26
- package/dist/table-view.d.ts +0 -34
- package/dist/tableColumnTrade.d.ts +0 -15
- package/dist/tableToolbar.d.ts +0 -14
- package/dist/toc-view.d.ts +0 -23
- package/dist/toolbar-editor.d.ts +0 -89
- package/dist/validate-signature.d.ts +0 -64
- package/dist/xlsx-import-cdn.d.ts +0 -1
- package/dist/xlsx-import.d.ts +0 -2
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
|
-
/**
|
|
8
|
+
/** Initial HTML content. */
|
|
9
9
|
content?: string;
|
|
10
|
-
/**
|
|
10
|
+
/** Placeholder shown while the document is empty. */
|
|
11
11
|
placeholder?: string;
|
|
12
|
-
/**
|
|
12
|
+
/** Accessible name for screen readers (ARIA). */
|
|
13
13
|
ariaLabel?: string;
|
|
14
|
-
/**
|
|
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
|
-
/**
|
|
55
|
+
/** The current document as plain HTML. */
|
|
74
56
|
getHTML(): string;
|
|
75
57
|
/**
|
|
76
|
-
*
|
|
58
|
+
* Replaces the content with the given HTML.
|
|
77
59
|
*
|
|
78
|
-
*
|
|
79
|
-
* undo
|
|
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
|
-
*
|
|
84
|
-
*
|
|
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
|
-
/**
|
|
70
|
+
/** Inserts HTML at the cursor, leaving the rest of the document alone. */
|
|
88
71
|
insertHtmlAtCursor(html: string): void;
|
|
89
72
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
92
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
*
|
|
112
|
-
*
|
|
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
|
|
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
|
-
/**
|
|
107
|
+
/** Changes the accessible name of the editing area (the host's aria-label). */
|
|
124
108
|
setAriaLabel(label: string): void;
|
|
125
|
-
/**
|
|
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
|
-
/**
|
|
113
|
+
/** Turns the licensed smart-paste pipeline on or off. */
|
|
130
114
|
/**
|
|
131
|
-
*
|
|
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
|
-
*
|
|
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
|
-
*
|
|
175
|
-
*
|
|
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
|
-
/**
|
|
138
|
+
/** Exports to Markdown and downloads the .md file. Runs in the browser. */
|
|
179
139
|
exportMarkdown(): Promise<void>;
|
|
180
|
-
/**
|
|
140
|
+
/** Exports to a self-contained .html file. Runs in the browser. */
|
|
181
141
|
exportHtml(): Promise<void>;
|
|
182
|
-
/**
|
|
142
|
+
/** Exports to plain text (.txt). Runs in the browser. */
|
|
183
143
|
exportText(): Promise<void>;
|
|
184
|
-
/**
|
|
144
|
+
/** Exports the document's tables to CSV. Runs in the browser. */
|
|
185
145
|
exportCsv(): Promise<void>;
|
|
186
|
-
/**
|
|
146
|
+
/** Exports to Word (.doc, Word-compatible HTML). Runs in the browser, no libraries. */
|
|
187
147
|
exportWord(): Promise<void>;
|
|
188
148
|
focus(): void;
|
|
189
|
-
/**
|
|
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
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
232
|
+
/** Inserts an image by src: a URL, a path or a data URI. */
|
|
280
233
|
insertImage(src: string, alt?: string): void;
|
|
281
|
-
/**
|
|
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
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
/**
|
|
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
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
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
|
-
/**
|
|
298
|
+
/** Whether the current cell can be split, i.e. it spans more than one column or row. */
|
|
347
299
|
isMergedCell(): boolean;
|
|
348
|
-
/**
|
|
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
|
-
/**
|
|
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 {};
|
package/dist/fallback.d.ts
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Graceful degradation for old browsers.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
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
|
-
/**
|
|
11
|
+
/** Replaces every <koda-editor> with a textarea. */
|
|
13
12
|
export declare function installFallback(tag?: string): void;
|
package/dist/i18n.d.ts
CHANGED
|
@@ -1,21 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Interface localisation for KodaEditor.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* Seven locales ship with the editor. Set one with the locale attribute on
|
|
5
|
+
* <koda-editor>, or let it be inherited from lang. Only interface strings are
|
|
6
|
+
* translated - button tooltips, ARIA labels, the watermark. The content of
|
|
7
|
+
* the document is never touched.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* дефолт сменён.
|
|
14
|
-
*
|
|
15
|
-
* Узбекский (uz-latn/uz-cyrl) убран в тот же день - был сделан под
|
|
16
|
-
* конкретного локального заказчика (meplab), тот больше не действует.
|
|
17
|
-
* Полная версия с узбекским сохранена в git-ветке
|
|
18
|
-
* archive/meplab-uzbek-locale, не удалена безвозвратно.
|
|
9
|
+
* English is the default when nothing is specified. If your users need a
|
|
10
|
+
* language that is not here, supply your own dictionary through the strings
|
|
11
|
+
* property or the strings-ref attribute: overrides are applied on top of the
|
|
12
|
+
* chosen locale, so a partial translation is fine.
|
|
19
13
|
*/
|
|
20
14
|
export type Locale = 'en' | 'ru' | 'es' | 'de' | 'ja' | 'fr' | 'ko';
|
|
21
15
|
export interface Strings {
|
|
@@ -120,7 +114,7 @@ export interface Strings {
|
|
|
120
114
|
imageWrongType: string;
|
|
121
115
|
imageUploadFailed: string;
|
|
122
116
|
watermark: string;
|
|
123
|
-
/**
|
|
117
|
+
/** Short text tiled across the canvas as the diagonal watermark. */
|
|
124
118
|
watermarkShort: string;
|
|
125
119
|
menubarLabel: string;
|
|
126
120
|
menuFile: string;
|
|
@@ -198,17 +192,12 @@ export interface Strings {
|
|
|
198
192
|
pagination: string;
|
|
199
193
|
}
|
|
200
194
|
/**
|
|
201
|
-
*
|
|
202
|
-
* По умолчанию (locale-атрибут не задан или не распознан) - 'en': продукт
|
|
203
|
-
* продаётся глобально под брендом KodaEditor, английский - базовый язык
|
|
204
|
-
* рынка. Явный 'ru' по-прежнему распознаётся и работает как раньше.
|
|
195
|
+
* Normalises an arbitrary locale string to a supported one.
|
|
205
196
|
*
|
|
206
|
-
*
|
|
207
|
-
*
|
|
208
|
-
*
|
|
209
|
-
*
|
|
210
|
-
* locale="uz-latn"/"uz-cyrl" теперь просто тихо откатывается на 'en' -
|
|
211
|
-
* не ошибка, деградация в духе остального проекта (не блокировка).
|
|
197
|
+
* Anything unrecognised, or nothing at all, resolves to 'en'. A regional tag
|
|
198
|
+
* is matched by its language part, so "de-AT" and "fr-CA" work as expected.
|
|
199
|
+
* An unsupported language is never an error: the editor falls back to English
|
|
200
|
+
* rather than refusing to start.
|
|
212
201
|
*/
|
|
213
202
|
export declare function resolveLocale(input?: string | null): Locale;
|
|
214
203
|
export declare function getStrings(locale: Locale): Strings;
|