@twip/web 0.0.0 → 0.1.0-alpha.1
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/LICENSE +202 -0
- package/dist/AccessibleNode.d.ts +51 -0
- package/dist/AccessibleNode.mjs +177 -0
- package/dist/Alignment.d.ts +38 -0
- package/dist/Alignment.mjs +90 -0
- package/dist/BorderEdges.d.ts +50 -0
- package/dist/BorderEdges.mjs +114 -0
- package/dist/BorderStyle.d.ts +27 -0
- package/dist/BorderStyle.mjs +81 -0
- package/dist/Bytes.d.ts +19 -0
- package/dist/Bytes.mjs +76 -0
- package/dist/CaretPosition.d.ts +34 -0
- package/dist/CaretPosition.mjs +148 -0
- package/dist/CellAlignment.d.ts +25 -0
- package/dist/CellAlignment.mjs +75 -0
- package/dist/CellShift.d.ts +30 -0
- package/dist/CellShift.mjs +78 -0
- package/dist/Clipboard.d.ts +22 -0
- package/dist/Clipboard.mjs +90 -0
- package/dist/ColumnSide.d.ts +24 -0
- package/dist/ColumnSide.mjs +72 -0
- package/dist/ControlKind.d.ts +28 -0
- package/dist/ControlKind.mjs +84 -0
- package/dist/ControlLock.d.ts +42 -0
- package/dist/ControlLock.mjs +96 -0
- package/dist/DocumentStatus.d.ts +34 -0
- package/dist/DocumentStatus.mjs +148 -0
- package/dist/Editor.d.ts +773 -0
- package/dist/Editor.mjs +2269 -0
- package/dist/EditorMode.d.ts +34 -0
- package/dist/EditorMode.mjs +84 -0
- package/dist/Element.d.ts +57 -0
- package/dist/Element.mjs +201 -0
- package/dist/ElementKind.d.ts +28 -0
- package/dist/ElementKind.mjs +78 -0
- package/dist/ElementList.d.ts +20 -0
- package/dist/ElementList.mjs +71 -0
- package/dist/ElementText.d.ts +34 -0
- package/dist/ElementText.mjs +84 -0
- package/dist/Event.d.ts +45 -0
- package/dist/Event.mjs +159 -0
- package/dist/EventKind.d.ts +39 -0
- package/dist/EventKind.mjs +93 -0
- package/dist/EventList.d.ts +20 -0
- package/dist/EventList.mjs +71 -0
- package/dist/Fonts.d.ts +29 -0
- package/dist/Fonts.mjs +107 -0
- package/dist/Highlight.d.ts +41 -0
- package/dist/Highlight.mjs +117 -0
- package/dist/MarginPreset.d.ts +38 -0
- package/dist/MarginPreset.mjs +90 -0
- package/dist/MarkSeverity.d.ts +25 -0
- package/dist/MarkSeverity.mjs +75 -0
- package/dist/Modifiers.d.ts +34 -0
- package/dist/Modifiers.mjs +148 -0
- package/dist/OpenError.d.ts +30 -0
- package/dist/OpenError.mjs +78 -0
- package/dist/Orientation.d.ts +30 -0
- package/dist/Orientation.mjs +78 -0
- package/dist/PageNumber.d.ts +34 -0
- package/dist/PageNumber.mjs +84 -0
- package/dist/PaperSize.d.ts +50 -0
- package/dist/PaperSize.mjs +108 -0
- package/dist/ParagraphBorders.d.ts +34 -0
- package/dist/ParagraphBorders.mjs +84 -0
- package/dist/PictureWrap.d.ts +34 -0
- package/dist/PictureWrap.mjs +90 -0
- package/dist/PointerKind.d.ts +23 -0
- package/dist/PointerKind.mjs +75 -0
- package/dist/Rect.d.ts +34 -0
- package/dist/Rect.mjs +148 -0
- package/dist/Request.d.ts +55 -0
- package/dist/Request.mjs +207 -0
- package/dist/RequestKind.d.ts +45 -0
- package/dist/RequestKind.mjs +105 -0
- package/dist/RequestList.d.ts +20 -0
- package/dist/RequestList.mjs +71 -0
- package/dist/RowHeightRule.d.ts +34 -0
- package/dist/RowHeightRule.mjs +84 -0
- package/dist/RowSide.d.ts +24 -0
- package/dist/RowSide.mjs +72 -0
- package/dist/SaveError.d.ts +24 -0
- package/dist/SaveError.mjs +72 -0
- package/dist/SelectionInfo.d.ts +39 -0
- package/dist/SelectionInfo.mjs +166 -0
- package/dist/SelectionKind.d.ts +37 -0
- package/dist/SelectionKind.mjs +93 -0
- package/dist/THIRD-PARTY-NOTICES.md +4475 -0
- package/dist/TableAlignment.d.ts +25 -0
- package/dist/TableAlignment.mjs +75 -0
- package/dist/TableSelection.d.ts +38 -0
- package/dist/TableSelection.mjs +90 -0
- package/dist/TableWidthUnit.d.ts +31 -0
- package/dist/TableWidthUnit.mjs +81 -0
- package/dist/TextUnit.d.ts +25 -0
- package/dist/TextUnit.mjs +75 -0
- package/dist/diplomat-runtime.d.ts +15 -0
- package/dist/diplomat-runtime.mjs +786 -0
- package/dist/diplomat-wasm.mjs +18 -0
- package/dist/gpu.d.ts +15 -0
- package/dist/gpu.mjs +42 -0
- package/dist/index.d.ts +98 -0
- package/dist/index.mjs +101 -0
- package/dist/twip-wasm.js +2 -0
- package/dist/twip_wasm.wasm +0 -0
- package/package.json +18 -4
package/dist/Editor.d.ts
ADDED
|
@@ -0,0 +1,773 @@
|
|
|
1
|
+
// generated by diplomat-tool
|
|
2
|
+
import type { AccessibleNode } from "./AccessibleNode"
|
|
3
|
+
import type { Alignment } from "./Alignment"
|
|
4
|
+
import type { BorderEdges } from "./BorderEdges"
|
|
5
|
+
import type { BorderStyle } from "./BorderStyle"
|
|
6
|
+
import type { Bytes } from "./Bytes"
|
|
7
|
+
import type { CaretPosition } from "./CaretPosition"
|
|
8
|
+
import type { CellAlignment } from "./CellAlignment"
|
|
9
|
+
import type { CellShift } from "./CellShift"
|
|
10
|
+
import type { Clipboard } from "./Clipboard"
|
|
11
|
+
import type { ColumnSide } from "./ColumnSide"
|
|
12
|
+
import type { ControlKind } from "./ControlKind"
|
|
13
|
+
import type { ControlLock } from "./ControlLock"
|
|
14
|
+
import type { DocumentStatus } from "./DocumentStatus"
|
|
15
|
+
import type { EditorMode } from "./EditorMode"
|
|
16
|
+
import type { ElementKind } from "./ElementKind"
|
|
17
|
+
import type { ElementList } from "./ElementList"
|
|
18
|
+
import type { ElementText } from "./ElementText"
|
|
19
|
+
import type { EventList } from "./EventList"
|
|
20
|
+
import type { Fonts } from "./Fonts"
|
|
21
|
+
import type { Highlight } from "./Highlight"
|
|
22
|
+
import type { MarginPreset } from "./MarginPreset"
|
|
23
|
+
import type { MarkSeverity } from "./MarkSeverity"
|
|
24
|
+
import type { Modifiers } from "./Modifiers"
|
|
25
|
+
import type { Modifiers_obj } from "./Modifiers"
|
|
26
|
+
import type { OpenError } from "./OpenError"
|
|
27
|
+
import type { Orientation } from "./Orientation"
|
|
28
|
+
import type { PageNumber } from "./PageNumber"
|
|
29
|
+
import type { PaperSize } from "./PaperSize"
|
|
30
|
+
import type { ParagraphBorders } from "./ParagraphBorders"
|
|
31
|
+
import type { PictureWrap } from "./PictureWrap"
|
|
32
|
+
import type { PointerKind } from "./PointerKind"
|
|
33
|
+
import type { Rect } from "./Rect"
|
|
34
|
+
import type { RequestList } from "./RequestList"
|
|
35
|
+
import type { RowHeightRule } from "./RowHeightRule"
|
|
36
|
+
import type { RowSide } from "./RowSide"
|
|
37
|
+
import type { SaveError } from "./SaveError"
|
|
38
|
+
import type { SelectionInfo } from "./SelectionInfo"
|
|
39
|
+
import type { TableAlignment } from "./TableAlignment"
|
|
40
|
+
import type { TableSelection } from "./TableSelection"
|
|
41
|
+
import type { TableWidthUnit } from "./TableWidthUnit"
|
|
42
|
+
import type { TextUnit } from "./TextUnit"
|
|
43
|
+
import type { pointer, codepoint } from "./diplomat-runtime.d.ts";
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* An editor for one document: input, commands, saving and drawing.
|
|
49
|
+
*/
|
|
50
|
+
export class Editor {
|
|
51
|
+
/** @internal */
|
|
52
|
+
get ffiValue(): pointer;
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Opens .docx bytes in place of the current document; on an error the current one stays.
|
|
57
|
+
*/
|
|
58
|
+
open(bytes: Uint8Array | Array<number>): void;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* The document as .docx bytes.
|
|
62
|
+
*/
|
|
63
|
+
save(): Bytes;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The document as PDF, laid out completely first.
|
|
67
|
+
*/
|
|
68
|
+
exportPdf(title: string): Bytes;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* Pages laid out so far (layout continues in the background: see `idle`).
|
|
72
|
+
*/
|
|
73
|
+
get pageCount(): number;
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A summary for logs: pages and whether there are unsaved changes.
|
|
77
|
+
*/
|
|
78
|
+
describe(): string;
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* Runs background layout for a while; true while there is more to do.
|
|
82
|
+
*/
|
|
83
|
+
idle(): boolean;
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* A key press (DOM `KeyboardEvent.code` names, e.g. `KeyB`, `ArrowLeft`); true if the editor handled it.
|
|
87
|
+
*/
|
|
88
|
+
key(code: string, mods: Modifiers_obj): boolean;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Text typed or composed (an IME's committed text).
|
|
92
|
+
*/
|
|
93
|
+
text(text: string): void;
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* A pointer event at (`x`, `y`) content pixels; true if the editor wants the pointer captured.
|
|
97
|
+
*/
|
|
98
|
+
pointer(kind: PointerKind, x: number, y: number, clicks: number, mods: Modifiers_obj): boolean;
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* The visible part of the content, in content pixels, and the device pixel ratio.
|
|
102
|
+
*/
|
|
103
|
+
setViewport(left: number, top: number, width: number, height: number, dpr: number): void;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Zoom: 1.0 = 100% (a point is 96/72 pixels).
|
|
107
|
+
*/
|
|
108
|
+
setZoom(zoom: number): void;
|
|
109
|
+
|
|
110
|
+
undo(): void;
|
|
111
|
+
|
|
112
|
+
redo(): void;
|
|
113
|
+
|
|
114
|
+
selectAll(): void;
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Copies the selection; `cut` deletes it too. `None` when nothing is selected.
|
|
118
|
+
*/
|
|
119
|
+
copy(cut: boolean): Clipboard | null;
|
|
120
|
+
|
|
121
|
+
/**
|
|
122
|
+
* Pastes: the content `token` names when it came from a Twip editor (`Clipboard.token`), else `text` as
|
|
123
|
+
* plain text.
|
|
124
|
+
*/
|
|
125
|
+
paste(text: string, token: string): void;
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Inserts a row above or below the selected rows.
|
|
129
|
+
*/
|
|
130
|
+
insertRow(side: RowSide): void;
|
|
131
|
+
|
|
132
|
+
/**
|
|
133
|
+
* Inserts a column left or right of the selected columns.
|
|
134
|
+
*/
|
|
135
|
+
insertColumn(side: ColumnSide): void;
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Deletes the selected rows.
|
|
139
|
+
*/
|
|
140
|
+
deleteRows(): void;
|
|
141
|
+
|
|
142
|
+
/**
|
|
143
|
+
* Deletes the selected columns.
|
|
144
|
+
*/
|
|
145
|
+
deleteColumns(): void;
|
|
146
|
+
|
|
147
|
+
/**
|
|
148
|
+
* Deletes the table around the selection.
|
|
149
|
+
*/
|
|
150
|
+
deleteTable(): void;
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* Deletes the selected cells, moving the remaining cells left or up.
|
|
154
|
+
*/
|
|
155
|
+
deleteCells(shift: CellShift): void;
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* Merges the selected cells into one.
|
|
159
|
+
*/
|
|
160
|
+
mergeCells(): void;
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* Splits the cell into `columns` cells side by side.
|
|
164
|
+
*/
|
|
165
|
+
splitCell(columns: number): void;
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* Splits the cell into `rows` cells stacked vertically.
|
|
169
|
+
*/
|
|
170
|
+
splitCellIntoRows(rows: number): void;
|
|
171
|
+
|
|
172
|
+
/**
|
|
173
|
+
* Selects the current cells, rows, columns or the whole table.
|
|
174
|
+
*/
|
|
175
|
+
selectInTable(part: TableSelection): void;
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* Gives the selected columns equal widths.
|
|
179
|
+
*/
|
|
180
|
+
distributeColumns(): void;
|
|
181
|
+
|
|
182
|
+
/**
|
|
183
|
+
* Gives the selected rows equal heights.
|
|
184
|
+
*/
|
|
185
|
+
distributeRows(): void;
|
|
186
|
+
|
|
187
|
+
/**
|
|
188
|
+
* Sets the vertical alignment of text in the selected cells.
|
|
189
|
+
*/
|
|
190
|
+
setCellAlignment(alignment: CellAlignment): void;
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Turns repeating the header rows at the top of each page on or off for the selected rows.
|
|
194
|
+
*/
|
|
195
|
+
toggleHeaderRow(): void;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Sets the borders on the given edges of the selected cells, with `width` in points and `color` as 0xRRGGBB (above 0xFFFFFF for automatic).
|
|
199
|
+
*/
|
|
200
|
+
setCellBorders(edges: BorderEdges, style: BorderStyle, width: number, color: number): void;
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* Sets the inner margins of the selected cells, in points.
|
|
204
|
+
*/
|
|
205
|
+
setCellMargins(top: number, left: number, bottom: number, right: number): void;
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* Sets the height of the selected rows, in points (ignored for `Auto`).
|
|
209
|
+
*/
|
|
210
|
+
setRowHeight(height: number, rule: RowHeightRule): void;
|
|
211
|
+
|
|
212
|
+
/**
|
|
213
|
+
* Turns allowing the selected rows to break across pages on or off.
|
|
214
|
+
*/
|
|
215
|
+
toggleRowBreakAcrossPages(): void;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Sets the width of the selected columns, in points.
|
|
219
|
+
*/
|
|
220
|
+
setColumnWidth(width: number): void;
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* Sets the table's preferred width, in points or as a percentage (ignored for `Auto`).
|
|
224
|
+
*/
|
|
225
|
+
setTableWidth(width: number, unit: TableWidthUnit): void;
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Aligns the table horizontally on the page.
|
|
229
|
+
*/
|
|
230
|
+
setTableAlignment(alignment: TableAlignment): void;
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Sets the table's indent from the margin, in points.
|
|
234
|
+
*/
|
|
235
|
+
setTableIndent(indent: number): void;
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* Applies the table style with this style id to the table.
|
|
239
|
+
*/
|
|
240
|
+
setTableStyle(styleId: string): void;
|
|
241
|
+
|
|
242
|
+
/**
|
|
243
|
+
* Sets which parts of the table get the table style's special formatting.
|
|
244
|
+
*/
|
|
245
|
+
setTableStyleOptions(headerRow: boolean, totalRow: boolean, firstColumn: boolean, lastColumn: boolean, bandedRows: boolean, bandedColumns: boolean): void;
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* Sets the fill colour of the selected cells as 0xRRGGBB, or removes it for a value above 0xFFFFFF.
|
|
249
|
+
*/
|
|
250
|
+
setCellShading(color: number): void;
|
|
251
|
+
|
|
252
|
+
/**
|
|
253
|
+
* Shows or hides gridlines on table cells that have no borders.
|
|
254
|
+
*/
|
|
255
|
+
setTableGridlines(show: boolean): void;
|
|
256
|
+
|
|
257
|
+
/**
|
|
258
|
+
* Deletes the selected picture.
|
|
259
|
+
*/
|
|
260
|
+
deletePicture(): void;
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* Sets how text wraps around the selected floating picture.
|
|
264
|
+
*/
|
|
265
|
+
setPictureWrap(wrap: PictureWrap): void;
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Locks or unlocks the selected floating picture's anchor.
|
|
269
|
+
*/
|
|
270
|
+
togglePictureAnchorLock(): void;
|
|
271
|
+
|
|
272
|
+
/**
|
|
273
|
+
* Returns the selected picture to its original size.
|
|
274
|
+
*/
|
|
275
|
+
resetPictureSize(): void;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* Sets the alternative text of the selected picture.
|
|
279
|
+
*/
|
|
280
|
+
setPictureAltText(text: string): void;
|
|
281
|
+
|
|
282
|
+
/**
|
|
283
|
+
* Sets the size of the selected picture, in points (both must be positive).
|
|
284
|
+
*/
|
|
285
|
+
setPictureSize(width: number, height: number): void;
|
|
286
|
+
|
|
287
|
+
/**
|
|
288
|
+
* Inserts a field with this code and result text at the caret, or right after element `after` (empty for the caret).
|
|
289
|
+
*/
|
|
290
|
+
insertField(code: string, display: string, showCode: boolean, after: string): void;
|
|
291
|
+
|
|
292
|
+
/**
|
|
293
|
+
* Changes a field's code and result text; an empty string keeps that part as it is.
|
|
294
|
+
*/
|
|
295
|
+
setField(id: string, code: string, display: string): void;
|
|
296
|
+
|
|
297
|
+
/**
|
|
298
|
+
* Inserts an empty field showing its code with the caret inside it, or turns the selected text into a field code.
|
|
299
|
+
*/
|
|
300
|
+
insertEmptyField(): void;
|
|
301
|
+
|
|
302
|
+
/**
|
|
303
|
+
* Asks the host to update field `id` and the fields inside it, or the fields at the selection when `id` is empty.
|
|
304
|
+
*/
|
|
305
|
+
updateFields(id: string): void;
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* Sets the result text of field `id` after the host computed it.
|
|
309
|
+
*/
|
|
310
|
+
setFieldResult(id: string, display: string): void;
|
|
311
|
+
|
|
312
|
+
/**
|
|
313
|
+
* Locks or unlocks field `id` and the fields inside it, or the fields at the selection when `id` is empty.
|
|
314
|
+
*/
|
|
315
|
+
setFieldsLocked(id: string, locked: boolean): void;
|
|
316
|
+
|
|
317
|
+
/**
|
|
318
|
+
* Replaces field `id`, or the fields at the selection when `id` is empty, with its result text.
|
|
319
|
+
*/
|
|
320
|
+
unlinkFields(id: string): void;
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* Sets the label shown in design mode for empty fields with this code; `replace_all` drops the other labels first, and an empty `code` with `replace_all` clears them all.
|
|
324
|
+
*/
|
|
325
|
+
setFieldLabel(code: string, label: string, replaceAll: boolean): void;
|
|
326
|
+
|
|
327
|
+
/**
|
|
328
|
+
* Removes a field or content control together with its content.
|
|
329
|
+
*/
|
|
330
|
+
removeElement(id: string): void;
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Selects a field or content control, scrolling it into view when `reveal` is true.
|
|
334
|
+
*/
|
|
335
|
+
selectElement(id: string, reveal: boolean): void;
|
|
336
|
+
|
|
337
|
+
/**
|
|
338
|
+
* Marks an element with a severity and a tooltip message; `clear_others` removes the other marks first, and an empty `id` with it clears all marks.
|
|
339
|
+
*/
|
|
340
|
+
markElement(id: string, severity: MarkSeverity, message: string, clearOthers: boolean): void;
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Replaces text in field codes or control tags or titles, in element `id` only or in all of them when `id` is empty.
|
|
344
|
+
*/
|
|
345
|
+
replaceInElements(find: string, replace: string, within: ElementText, kind: ElementKind, id: string): void;
|
|
346
|
+
|
|
347
|
+
/**
|
|
348
|
+
* Inserts a content control at the caret or after element `after`, or around the selection with `wrap_selection` (rich text and group only); empty strings use the defaults.
|
|
349
|
+
*/
|
|
350
|
+
insertControl(kind: ControlKind, tag: string, alias: string, placeholder: string, lock: ControlLock, binding: string, wrapSelection: boolean, multiLine: boolean, checked: boolean, dateFormat: string, after: string): void;
|
|
351
|
+
|
|
352
|
+
/**
|
|
353
|
+
* Changes a content control's tag, title, data binding, placeholder text and lock; empty strings and `Unchanged` keep what it has.
|
|
354
|
+
*/
|
|
355
|
+
setControl(id: string, tag: string, alias: string, binding: string, placeholder: string, lock: ControlLock): void;
|
|
356
|
+
|
|
357
|
+
/**
|
|
358
|
+
* Removes a content control, keeping its content in the document when `keep_content` is true.
|
|
359
|
+
*/
|
|
360
|
+
removeControl(id: string, keepContent: boolean): void;
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* Replaces the content of a plain-text, date or rich-text control with this text.
|
|
364
|
+
*/
|
|
365
|
+
fillControl(id: string, text: string): void;
|
|
366
|
+
|
|
367
|
+
/**
|
|
368
|
+
* Wraps the selected table rows or paragraphs in a new repeating section, with an optional tag and title (empty for none).
|
|
369
|
+
*/
|
|
370
|
+
wrapInRepeatingSection(tag: string, alias: string): void;
|
|
371
|
+
|
|
372
|
+
/**
|
|
373
|
+
* Writes an XML data part whose root is in `namespace`, replacing the part with that namespace (and `item_id` when not empty) or adding a new one.
|
|
374
|
+
*/
|
|
375
|
+
writeDataPart(namespace: string, itemId: string, xml: string): void;
|
|
376
|
+
|
|
377
|
+
/**
|
|
378
|
+
* Removes the XML data part with this namespace (and `item_id` when not empty).
|
|
379
|
+
*/
|
|
380
|
+
removeDataPart(namespace: string, itemId: string): void;
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Toggles bold on the selection (or the next typed text).
|
|
384
|
+
*/
|
|
385
|
+
bold(): void;
|
|
386
|
+
|
|
387
|
+
/**
|
|
388
|
+
* Toggles italic on the selection (or the next typed text).
|
|
389
|
+
*/
|
|
390
|
+
italic(): void;
|
|
391
|
+
|
|
392
|
+
/**
|
|
393
|
+
* Toggles a single underline on the selection (or the next typed text).
|
|
394
|
+
*/
|
|
395
|
+
underline(): void;
|
|
396
|
+
|
|
397
|
+
/**
|
|
398
|
+
* Toggles strikethrough on the selection (or the next typed text).
|
|
399
|
+
*/
|
|
400
|
+
strikethrough(): void;
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Toggles subscript on the selection (or the next typed text).
|
|
404
|
+
*/
|
|
405
|
+
subscript(): void;
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Toggles superscript on the selection (or the next typed text).
|
|
409
|
+
*/
|
|
410
|
+
superscript(): void;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Sets the font family of the selection (or the next typed text).
|
|
414
|
+
*/
|
|
415
|
+
setFont(family: string): void;
|
|
416
|
+
|
|
417
|
+
/**
|
|
418
|
+
* Sets the font size of the selection (or the next typed text), rounded to the nearest half point.
|
|
419
|
+
*/
|
|
420
|
+
setFontSize(points: number): void;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Makes the selected text one step larger in the standard font size list.
|
|
424
|
+
*/
|
|
425
|
+
growFont(): void;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Makes the selected text one step smaller in the standard font size list.
|
|
429
|
+
*/
|
|
430
|
+
shrinkFont(): void;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Sets the text colour of the selection (or the next typed text).
|
|
434
|
+
*/
|
|
435
|
+
setFontColor(color: number): void;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Gives the selection (or the next typed text) the automatic text colour.
|
|
439
|
+
*/
|
|
440
|
+
setFontColorAutomatic(): void;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Highlights the selection (or the next typed text) in a colour, or removes the highlight.
|
|
444
|
+
*/
|
|
445
|
+
setHighlight(color: Highlight): void;
|
|
446
|
+
|
|
447
|
+
/**
|
|
448
|
+
* Removes the direct character formatting from the selection.
|
|
449
|
+
*/
|
|
450
|
+
clearFormatting(): void;
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Applies a paragraph style to the selected paragraphs; nothing happens if the document has no such style.
|
|
454
|
+
*/
|
|
455
|
+
setStyle(styleId: string): void;
|
|
456
|
+
|
|
457
|
+
/**
|
|
458
|
+
* Toggles a bulleted list on the selected paragraphs.
|
|
459
|
+
*/
|
|
460
|
+
bullets(): void;
|
|
461
|
+
|
|
462
|
+
/**
|
|
463
|
+
* Toggles a numbered list on the selected paragraphs.
|
|
464
|
+
*/
|
|
465
|
+
numbering(): void;
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* Moves the selected paragraphs' left indent in by half an inch.
|
|
469
|
+
*/
|
|
470
|
+
increaseIndent(): void;
|
|
471
|
+
|
|
472
|
+
/**
|
|
473
|
+
* Moves the selected paragraphs' left indent out by half an inch, not below zero.
|
|
474
|
+
*/
|
|
475
|
+
decreaseIndent(): void;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* Aligns the selected paragraphs.
|
|
479
|
+
*/
|
|
480
|
+
setAlignment(alignment: Alignment): void;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Sets the selected paragraphs' line spacing as a multiple of single spacing.
|
|
484
|
+
*/
|
|
485
|
+
setLineSpacing(multiple: number): void;
|
|
486
|
+
|
|
487
|
+
/**
|
|
488
|
+
* Adds 12 points of space before the selected paragraphs, or removes it when the first one already has some.
|
|
489
|
+
*/
|
|
490
|
+
toggleSpaceBefore(): void;
|
|
491
|
+
|
|
492
|
+
/**
|
|
493
|
+
* Removes the space after the selected paragraphs.
|
|
494
|
+
*/
|
|
495
|
+
removeSpaceAfter(): void;
|
|
496
|
+
|
|
497
|
+
/**
|
|
498
|
+
* Toggles keeping the selected paragraphs on the same page as the next one.
|
|
499
|
+
*/
|
|
500
|
+
keepWithNext(): void;
|
|
501
|
+
|
|
502
|
+
/**
|
|
503
|
+
* Sets the borders of the selected paragraphs.
|
|
504
|
+
*/
|
|
505
|
+
setParagraphBorders(borders: ParagraphBorders): void;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Fills the background of the selected paragraphs with a colour.
|
|
509
|
+
*/
|
|
510
|
+
setParagraphShading(color: number): void;
|
|
511
|
+
|
|
512
|
+
/**
|
|
513
|
+
* Removes the background colour of the selected paragraphs.
|
|
514
|
+
*/
|
|
515
|
+
clearParagraphShading(): void;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* Ends the paragraph at the caret and starts a new one, as pressing Enter does.
|
|
519
|
+
*/
|
|
520
|
+
insertParagraph(): void;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* Inserts a tab character at the caret.
|
|
524
|
+
*/
|
|
525
|
+
insertTab(): void;
|
|
526
|
+
|
|
527
|
+
/**
|
|
528
|
+
* Redoes the last undone change, or else repeats the last edit at the selection.
|
|
529
|
+
*/
|
|
530
|
+
repeat(): void;
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Selects the word, sentence or paragraph at the caret.
|
|
534
|
+
*/
|
|
535
|
+
select(unit: TextUnit): void;
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* Selects text within one paragraph and scrolls it into view.
|
|
539
|
+
*/
|
|
540
|
+
selectRange(paragraph: bigint, start: number, end: number): void;
|
|
541
|
+
|
|
542
|
+
/**
|
|
543
|
+
* Replaces every occurrence of a text in the document body, as one undo step.
|
|
544
|
+
*/
|
|
545
|
+
replaceAll(find: string, replacement: string, matchCase: boolean): void;
|
|
546
|
+
|
|
547
|
+
/**
|
|
548
|
+
* Inserts an empty table at the caret.
|
|
549
|
+
*/
|
|
550
|
+
insertTable(rows: number, cols: number): void;
|
|
551
|
+
|
|
552
|
+
/**
|
|
553
|
+
* Inserts a picture at the caret at its own size, scaled down to the text width if wider, and selects it.
|
|
554
|
+
*/
|
|
555
|
+
insertPicture(image: Uint8Array | Array<number>): void;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Inserts a 2 x 1 inch text box in front of the text at the caret and puts the caret in it.
|
|
559
|
+
*/
|
|
560
|
+
insertTextBox(): void;
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* Inserts an unchecked checkbox content control at the caret.
|
|
564
|
+
*/
|
|
565
|
+
insertCheckbox(): void;
|
|
566
|
+
|
|
567
|
+
/**
|
|
568
|
+
* Inserts a symbol character at the caret, optionally in a given font.
|
|
569
|
+
*/
|
|
570
|
+
insertSymbol(symbol: string, font: string): void;
|
|
571
|
+
|
|
572
|
+
/**
|
|
573
|
+
* Inserts a footnote reference at the caret and moves the caret to the new note's text.
|
|
574
|
+
*/
|
|
575
|
+
insertFootnote(): void;
|
|
576
|
+
|
|
577
|
+
/**
|
|
578
|
+
* Inserts an endnote reference at the caret and moves the caret to the new note's text.
|
|
579
|
+
*/
|
|
580
|
+
insertEndnote(): void;
|
|
581
|
+
|
|
582
|
+
/**
|
|
583
|
+
* Inserts a page number field at the caret (in a header, footer or the body).
|
|
584
|
+
*/
|
|
585
|
+
insertPageNumber(kind: PageNumber): void;
|
|
586
|
+
|
|
587
|
+
/**
|
|
588
|
+
* Inserts a page break at the caret.
|
|
589
|
+
*/
|
|
590
|
+
insertPageBreak(): void;
|
|
591
|
+
|
|
592
|
+
/**
|
|
593
|
+
* Inserts a column break at the caret.
|
|
594
|
+
*/
|
|
595
|
+
insertColumnBreak(): void;
|
|
596
|
+
|
|
597
|
+
/**
|
|
598
|
+
* Inserts a line break at the caret, starting a new line in the same paragraph.
|
|
599
|
+
*/
|
|
600
|
+
insertLineBreak(): void;
|
|
601
|
+
|
|
602
|
+
/**
|
|
603
|
+
* Sets the page margins of the current section to a preset.
|
|
604
|
+
*/
|
|
605
|
+
setMargins(preset: MarginPreset): void;
|
|
606
|
+
|
|
607
|
+
/**
|
|
608
|
+
* Turns the current section's pages to portrait or landscape, turning the margins with them.
|
|
609
|
+
*/
|
|
610
|
+
setOrientation(orientation: Orientation): void;
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* Sets the paper size of the current section, keeping its orientation.
|
|
614
|
+
*/
|
|
615
|
+
setPaperSize(size: PaperSize): void;
|
|
616
|
+
|
|
617
|
+
/**
|
|
618
|
+
* Lays out the current section in equal-width text columns.
|
|
619
|
+
*/
|
|
620
|
+
setColumns(count: number): void;
|
|
621
|
+
|
|
622
|
+
/**
|
|
623
|
+
* Moves the caret into the current page's header, creating an empty one if there is none.
|
|
624
|
+
*/
|
|
625
|
+
editHeader(): void;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* Moves the caret into the current page's footer, creating an empty one if there is none.
|
|
629
|
+
*/
|
|
630
|
+
editFooter(): void;
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Leaves the header or footer and returns the caret to the body.
|
|
634
|
+
*/
|
|
635
|
+
closeHeaderFooter(): void;
|
|
636
|
+
|
|
637
|
+
/**
|
|
638
|
+
* Toggles a different header and footer on the first page of the current section.
|
|
639
|
+
*/
|
|
640
|
+
differentFirstPage(): void;
|
|
641
|
+
|
|
642
|
+
/**
|
|
643
|
+
* Switches between editing, template design and read-only viewing.
|
|
644
|
+
*/
|
|
645
|
+
setMode(mode: EditorMode): void;
|
|
646
|
+
|
|
647
|
+
/**
|
|
648
|
+
* Zooms in by 10%, up to 400%.
|
|
649
|
+
*/
|
|
650
|
+
zoomIn(): void;
|
|
651
|
+
|
|
652
|
+
/**
|
|
653
|
+
* Zooms out by 10%, down to 25%.
|
|
654
|
+
*/
|
|
655
|
+
zoomOut(): void;
|
|
656
|
+
|
|
657
|
+
/**
|
|
658
|
+
* Sets how placeholders with a given key are drawn: a fill colour, a label and an icon.
|
|
659
|
+
*/
|
|
660
|
+
setPlaceholderLook(key: string, color: number, label: string, iconSvg: string): void;
|
|
661
|
+
|
|
662
|
+
/**
|
|
663
|
+
* Restores the default look of placeholders with a given key.
|
|
664
|
+
*/
|
|
665
|
+
clearPlaceholderLook(key: string): void;
|
|
666
|
+
|
|
667
|
+
/**
|
|
668
|
+
* Toggles code view for every field (`all`) or for the fields at the caret.
|
|
669
|
+
*/
|
|
670
|
+
toggleFieldCodes(all: boolean): void;
|
|
671
|
+
|
|
672
|
+
/**
|
|
673
|
+
* Shows every field's code (`true`) or its result (`false`).
|
|
674
|
+
*/
|
|
675
|
+
showFieldCodes(show: boolean): void;
|
|
676
|
+
|
|
677
|
+
/**
|
|
678
|
+
* Shows the drop caret where a dragged item would land, at (`x`, `y`) content pixels.
|
|
679
|
+
*/
|
|
680
|
+
setDropCaret(x: number, y: number): void;
|
|
681
|
+
|
|
682
|
+
/**
|
|
683
|
+
* Hides the drop caret.
|
|
684
|
+
*/
|
|
685
|
+
clearDropCaret(): void;
|
|
686
|
+
|
|
687
|
+
/**
|
|
688
|
+
* The status bar's numbers.
|
|
689
|
+
*/
|
|
690
|
+
status(): DocumentStatus;
|
|
691
|
+
|
|
692
|
+
/**
|
|
693
|
+
* The selection.
|
|
694
|
+
*/
|
|
695
|
+
selection(): SelectionInfo;
|
|
696
|
+
|
|
697
|
+
/**
|
|
698
|
+
* The document's reading structure, for assistive technology.
|
|
699
|
+
*/
|
|
700
|
+
accessibleTree(): AccessibleNode;
|
|
701
|
+
|
|
702
|
+
/**
|
|
703
|
+
* The fields and content controls in document order; `kind` filters (`field`, `plain_text`, ...; empty for
|
|
704
|
+
* all).
|
|
705
|
+
*/
|
|
706
|
+
elements(kind: string): ElementList;
|
|
707
|
+
|
|
708
|
+
/**
|
|
709
|
+
* What the editor asked of the host since the last call (scroll, cursor, clipboard, ...). Call after inputs.
|
|
710
|
+
*/
|
|
711
|
+
takeRequests(): RequestList;
|
|
712
|
+
|
|
713
|
+
/**
|
|
714
|
+
* What happened that the application may act on since the last call.
|
|
715
|
+
*/
|
|
716
|
+
takeEvents(): EventList;
|
|
717
|
+
|
|
718
|
+
/**
|
|
719
|
+
* As `paint`, into a new buffer (JavaScript can't lend one). `None` for an empty size.
|
|
720
|
+
*/
|
|
721
|
+
paint(width: number, height: number, originX: number, originY: number, dpr: number): Bytes | null;
|
|
722
|
+
|
|
723
|
+
/**
|
|
724
|
+
* Browser: a WebGPU instance handle for `Module.WebGPU.importJsDevice` / `importJsQueue` (see the web
|
|
725
|
+
* package's `attachWebGpu` helper).
|
|
726
|
+
*/
|
|
727
|
+
static webgpuInstance(): number;
|
|
728
|
+
|
|
729
|
+
/**
|
|
730
|
+
* Browser: adopts the page's WebGPU device for every editor (imported device and queue handles, and the
|
|
731
|
+
* instance from `webgpu_instance`). False when it can't be used: paint with WebGL instead.
|
|
732
|
+
*/
|
|
733
|
+
static attachWebgpu(instance: number, device: number, queue: number): boolean;
|
|
734
|
+
|
|
735
|
+
/**
|
|
736
|
+
* Browser: paints the pages under the viewport into a WebGPU canvas texture (a handle from
|
|
737
|
+
* `importJsTexture`, released here); `height` is the texture's height in pixels. False if nothing was drawn.
|
|
738
|
+
*/
|
|
739
|
+
paintWebgpu(texture: number, bgra: boolean, originX: number, originY: number, height: number, dpr: number): boolean;
|
|
740
|
+
|
|
741
|
+
/**
|
|
742
|
+
* Browser: adopts the current WebGL 2 context (made current with `Module.GL.makeContextCurrent`) for this
|
|
743
|
+
* editor's canvas.
|
|
744
|
+
*/
|
|
745
|
+
attachWebgl(): boolean;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Browser: paints the pages under the viewport into this editor's WebGL canvas (`width` x `height` device
|
|
749
|
+
* pixels, its context current).
|
|
750
|
+
*/
|
|
751
|
+
paintWebgl(originX: number, originY: number, width: number, height: number, dpr: number): boolean;
|
|
752
|
+
|
|
753
|
+
/**
|
|
754
|
+
* The caret, content pixels.
|
|
755
|
+
*/
|
|
756
|
+
caret(): CaretPosition;
|
|
757
|
+
|
|
758
|
+
/**
|
|
759
|
+
* The size of all pages stacked with their gaps, content pixels (what the host scrolls).
|
|
760
|
+
*/
|
|
761
|
+
contentSize(): Rect;
|
|
762
|
+
|
|
763
|
+
/**
|
|
764
|
+
* Fills the selected placeholder (`key` empty) or every unfilled one with `key`, with an image file's bytes;
|
|
765
|
+
* how many were filled.
|
|
766
|
+
*/
|
|
767
|
+
fillPlaceholder(key: string, image: Uint8Array | Array<number>): number;
|
|
768
|
+
|
|
769
|
+
/**
|
|
770
|
+
* An editor holding a new, empty US Letter document.
|
|
771
|
+
*/
|
|
772
|
+
constructor(fonts: Fonts);
|
|
773
|
+
}
|