@vector-im/matrix-wysiwyg 2.37.13 → 2.38.0

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.
@@ -0,0 +1,512 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ /**
4
+ */
5
+ export function start(): void;
6
+ /**
7
+ * @returns {ComposerModel}
8
+ */
9
+ export function new_composer_model(): ComposerModel;
10
+ /**
11
+ * @param {string} html
12
+ * @param {number} start_utf16_codeunit
13
+ * @param {number} end_utf16_codeunit
14
+ * @returns {ComposerModel}
15
+ */
16
+ export function new_composer_model_from_html(html: string, start_utf16_codeunit: number, end_utf16_codeunit: number): ComposerModel;
17
+ /**
18
+ */
19
+ export enum PatternKeyType {
20
+ At = 0,
21
+ Hash = 1,
22
+ Slash = 2,
23
+ Custom = 3,
24
+ }
25
+ /**
26
+ */
27
+ export enum DomCreationError {
28
+ HtmlParseError = 0,
29
+ MarkdownParseError = 1,
30
+ }
31
+ /**
32
+ */
33
+ export enum ComposerAction {
34
+ Bold = 0,
35
+ Italic = 1,
36
+ StrikeThrough = 2,
37
+ Underline = 3,
38
+ InlineCode = 4,
39
+ Link = 5,
40
+ Undo = 6,
41
+ Redo = 7,
42
+ OrderedList = 8,
43
+ UnorderedList = 9,
44
+ Indent = 10,
45
+ Unindent = 11,
46
+ CodeBlock = 12,
47
+ Quote = 13,
48
+ }
49
+ /**
50
+ */
51
+ export enum ActionState {
52
+ /**
53
+ * The button can be clicked, and will perform its normal action
54
+ * e.g. make something bold
55
+ */
56
+ Enabled = 0,
57
+ /**
58
+ * The button can be clicked, and will perform the reverse of its
59
+ * normal action e.g. stop something being bold
60
+ */
61
+ Reversed = 1,
62
+ /**
63
+ * The button cannot be clicked
64
+ */
65
+ Disabled = 2,
66
+ }
67
+ /**
68
+ */
69
+ export class ComposerModel {
70
+ free(): void;
71
+ /**
72
+ * @returns {ComposerModel}
73
+ */
74
+ static new(): ComposerModel;
75
+ /**
76
+ * @param {string} text
77
+ * @returns {ComposerModel}
78
+ */
79
+ static from_example_format(text: string): ComposerModel;
80
+ /**
81
+ * @returns {string}
82
+ */
83
+ to_example_format(): string;
84
+ /**
85
+ * @returns {string}
86
+ */
87
+ get_content_as_html(): string;
88
+ /**
89
+ * @returns {string}
90
+ */
91
+ get_content_as_message_html(): string;
92
+ /**
93
+ * @returns {string}
94
+ */
95
+ get_content_as_markdown(): string;
96
+ /**
97
+ * @returns {string}
98
+ */
99
+ get_content_as_message_markdown(): string;
100
+ /**
101
+ * @returns {string}
102
+ */
103
+ get_content_as_plain_text(): string;
104
+ /**
105
+ * @returns {DomHandle}
106
+ */
107
+ document(): DomHandle;
108
+ /**
109
+ * @returns {Map<any, any>}
110
+ */
111
+ action_states(): Map<any, any>;
112
+ /**
113
+ * @param {number} start_utf16_codeunit
114
+ * @param {number} end_utf16_codeunit
115
+ * @returns {ComposerUpdate}
116
+ */
117
+ select(start_utf16_codeunit: number, end_utf16_codeunit: number): ComposerUpdate;
118
+ /**
119
+ * @returns {number}
120
+ */
121
+ selection_start(): number;
122
+ /**
123
+ * @returns {number}
124
+ */
125
+ selection_end(): number;
126
+ /**
127
+ * @param {string} new_text
128
+ * @returns {ComposerUpdate}
129
+ */
130
+ replace_text(new_text: string): ComposerUpdate;
131
+ /**
132
+ * @param {string} new_text
133
+ * @param {SuggestionPattern} suggestion
134
+ * @param {boolean} append_space
135
+ * @returns {ComposerUpdate}
136
+ */
137
+ replace_text_suggestion(new_text: string, suggestion: SuggestionPattern, append_space: boolean): ComposerUpdate;
138
+ /**
139
+ * @param {string} text
140
+ * @returns {ComposerUpdate}
141
+ */
142
+ set_content_from_html(text: string): ComposerUpdate;
143
+ /**
144
+ * @param {string} text
145
+ * @returns {ComposerUpdate}
146
+ */
147
+ set_content_from_markdown(text: string): ComposerUpdate;
148
+ /**
149
+ * @returns {ComposerUpdate}
150
+ */
151
+ clear(): ComposerUpdate;
152
+ /**
153
+ * @returns {ComposerUpdate}
154
+ */
155
+ enter(): ComposerUpdate;
156
+ /**
157
+ * @returns {ComposerUpdate}
158
+ */
159
+ backspace(): ComposerUpdate;
160
+ /**
161
+ * @returns {ComposerUpdate}
162
+ */
163
+ backspace_word(): ComposerUpdate;
164
+ /**
165
+ * @returns {ComposerUpdate}
166
+ */
167
+ delete(): ComposerUpdate;
168
+ /**
169
+ * @returns {ComposerUpdate}
170
+ */
171
+ delete_word(): ComposerUpdate;
172
+ /**
173
+ * @returns {ComposerUpdate}
174
+ */
175
+ bold(): ComposerUpdate;
176
+ /**
177
+ * @returns {ComposerUpdate}
178
+ */
179
+ italic(): ComposerUpdate;
180
+ /**
181
+ * @returns {ComposerUpdate}
182
+ */
183
+ strike_through(): ComposerUpdate;
184
+ /**
185
+ * @returns {ComposerUpdate}
186
+ */
187
+ underline(): ComposerUpdate;
188
+ /**
189
+ * @returns {ComposerUpdate}
190
+ */
191
+ quote(): ComposerUpdate;
192
+ /**
193
+ * @returns {ComposerUpdate}
194
+ */
195
+ inline_code(): ComposerUpdate;
196
+ /**
197
+ * @returns {ComposerUpdate}
198
+ */
199
+ code_block(): ComposerUpdate;
200
+ /**
201
+ * @returns {ComposerUpdate}
202
+ */
203
+ undo(): ComposerUpdate;
204
+ /**
205
+ * @returns {ComposerUpdate}
206
+ */
207
+ redo(): ComposerUpdate;
208
+ /**
209
+ * @returns {ComposerUpdate}
210
+ */
211
+ ordered_list(): ComposerUpdate;
212
+ /**
213
+ * @returns {ComposerUpdate}
214
+ */
215
+ unordered_list(): ComposerUpdate;
216
+ /**
217
+ * @returns {ComposerUpdate}
218
+ */
219
+ indent(): ComposerUpdate;
220
+ /**
221
+ * @returns {ComposerUpdate}
222
+ */
223
+ unindent(): ComposerUpdate;
224
+ /**
225
+ * @returns {LinkAction}
226
+ */
227
+ get_link_action(): LinkAction;
228
+ /**
229
+ * @param {string} url
230
+ * @param {Map<any, any>} attributes
231
+ * @returns {ComposerUpdate}
232
+ */
233
+ set_link(url: string, attributes: Map<any, any>): ComposerUpdate;
234
+ /**
235
+ * @param {string} url
236
+ * @param {string} text
237
+ * @param {Map<any, any>} attributes
238
+ * @returns {ComposerUpdate}
239
+ */
240
+ set_link_with_text(url: string, text: string, attributes: Map<any, any>): ComposerUpdate;
241
+ /**
242
+ * @param {Array<any>} custom_suggestion_patterns
243
+ */
244
+ set_custom_suggestion_patterns(custom_suggestion_patterns: Array<any>): void;
245
+ /**
246
+ * Creates an at-room mention node and inserts it into the composer at the current selection
247
+ * @param {Map<any, any>} attributes
248
+ * @returns {ComposerUpdate}
249
+ */
250
+ insert_at_room_mention(attributes: Map<any, any>): ComposerUpdate;
251
+ /**
252
+ * Creates a mention node and inserts it into the composer at the current selection
253
+ * @param {string} url
254
+ * @param {string} text
255
+ * @param {Map<any, any>} attributes
256
+ * @returns {ComposerUpdate}
257
+ */
258
+ insert_mention(url: string, text: string, attributes: Map<any, any>): ComposerUpdate;
259
+ /**
260
+ * Creates an at-room mention node and inserts it into the composer, replacing the
261
+ * text content defined by the suggestion
262
+ * @param {SuggestionPattern} suggestion
263
+ * @param {Map<any, any>} attributes
264
+ * @returns {ComposerUpdate}
265
+ */
266
+ insert_at_room_mention_at_suggestion(suggestion: SuggestionPattern, attributes: Map<any, any>): ComposerUpdate;
267
+ /**
268
+ * Creates a mention node and inserts it into the composer, replacing the
269
+ * text content defined by the suggestion
270
+ * @param {string} url
271
+ * @param {string} text
272
+ * @param {SuggestionPattern} suggestion
273
+ * @param {Map<any, any>} attributes
274
+ * @returns {ComposerUpdate}
275
+ */
276
+ insert_mention_at_suggestion(url: string, text: string, suggestion: SuggestionPattern, attributes: Map<any, any>): ComposerUpdate;
277
+ /**
278
+ * @returns {ComposerUpdate}
279
+ */
280
+ remove_links(): ComposerUpdate;
281
+ }
282
+ /**
283
+ */
284
+ export class ComposerUpdate {
285
+ free(): void;
286
+ /**
287
+ * @returns {TextUpdate}
288
+ */
289
+ text_update(): TextUpdate;
290
+ /**
291
+ * @returns {MenuState}
292
+ */
293
+ menu_state(): MenuState;
294
+ /**
295
+ * @returns {MenuAction}
296
+ */
297
+ menu_action(): MenuAction;
298
+ }
299
+ /**
300
+ */
301
+ export class Create {
302
+ free(): void;
303
+ }
304
+ /**
305
+ */
306
+ export class CreateWithText {
307
+ free(): void;
308
+ }
309
+ /**
310
+ */
311
+ export class Disabled {
312
+ free(): void;
313
+ }
314
+ /**
315
+ * An iterator-like view of a DomHandle's children, written to work around
316
+ * the lack of support for returning Vec<T> in wasm_bindgen.
317
+ */
318
+ export class DomChildren {
319
+ free(): void;
320
+ /**
321
+ * @returns {DomHandle | undefined}
322
+ */
323
+ next_child(): DomHandle | undefined;
324
+ }
325
+ /**
326
+ * Refers to a node in the composer model.
327
+ */
328
+ export class DomHandle {
329
+ free(): void;
330
+ /**
331
+ * Returns "container", "line_break", "text" or "zwsp" depending on the type of
332
+ * node we refer to.
333
+ * Panics if we are not a valid reference (because the model has changed
334
+ * since we were created, or because you passed in a different model
335
+ * from the one that created us.)
336
+ * @param {ComposerModel} model
337
+ * @returns {string}
338
+ */
339
+ node_type(model: ComposerModel): string;
340
+ /**
341
+ * Returns a list of our children nodes, or an empty list if we refer
342
+ * to a text or line break node.
343
+ * Panics if we are not a valid reference (because the model has changed
344
+ * since we were created, or because you passed in a different model
345
+ * from the one that created us.)
346
+ * @param {ComposerModel} model
347
+ * @returns {DomChildren}
348
+ */
349
+ children(model: ComposerModel): DomChildren;
350
+ /**
351
+ * Returns the text of this node, or an empty string if this is a
352
+ * container or line break.
353
+ * Panics if we are not a valid reference (because the model has changed
354
+ * since we were created, or because you passed in a different model
355
+ * from the one that created us.)
356
+ * @param {ComposerModel} model
357
+ * @returns {string}
358
+ */
359
+ text(model: ComposerModel): string;
360
+ /**
361
+ * Returns our tagname, or "-text-"/"-zwsp-" if we are a text/zwsp node.
362
+ * Panics if we are not a valid reference (because the model has changed
363
+ * since we were created, or because you passed in a different model
364
+ * from the one that created us.)
365
+ * @param {ComposerModel} model
366
+ * @returns {string}
367
+ */
368
+ tag(model: ComposerModel): string;
369
+ }
370
+ /**
371
+ */
372
+ export class Edit {
373
+ free(): void;
374
+ /**
375
+ */
376
+ url: string;
377
+ }
378
+ /**
379
+ */
380
+ export class Keep {
381
+ free(): void;
382
+ }
383
+ /**
384
+ */
385
+ export class LinkAction {
386
+ free(): void;
387
+ /**
388
+ */
389
+ create?: Create;
390
+ /**
391
+ */
392
+ create_with_text?: CreateWithText;
393
+ /**
394
+ */
395
+ disabled?: Disabled;
396
+ /**
397
+ */
398
+ edit_link?: Edit;
399
+ }
400
+ /**
401
+ */
402
+ export class MenuAction {
403
+ free(): void;
404
+ /**
405
+ * @returns {boolean}
406
+ */
407
+ keep(): boolean;
408
+ /**
409
+ * @returns {boolean}
410
+ */
411
+ none(): boolean;
412
+ /**
413
+ * @returns {MenuActionSuggestion | undefined}
414
+ */
415
+ suggestion(): MenuActionSuggestion | undefined;
416
+ }
417
+ /**
418
+ */
419
+ export class MenuActionSuggestion {
420
+ free(): void;
421
+ /**
422
+ */
423
+ suggestion_pattern: SuggestionPattern;
424
+ }
425
+ /**
426
+ */
427
+ export class MenuState {
428
+ free(): void;
429
+ /**
430
+ * @returns {boolean}
431
+ */
432
+ keep(): boolean;
433
+ /**
434
+ * @returns {MenuStateUpdate | undefined}
435
+ */
436
+ update(): MenuStateUpdate | undefined;
437
+ }
438
+ /**
439
+ */
440
+ export class MenuStateUpdate {
441
+ free(): void;
442
+ /**
443
+ */
444
+ action_states: Map<any, any>;
445
+ }
446
+ /**
447
+ */
448
+ export class PatternKey {
449
+ free(): void;
450
+ /**
451
+ */
452
+ custom_key_value?: string;
453
+ /**
454
+ */
455
+ key_type: PatternKeyType;
456
+ }
457
+ /**
458
+ */
459
+ export class ReplaceAll {
460
+ free(): void;
461
+ /**
462
+ */
463
+ end_utf16_codeunit: number;
464
+ /**
465
+ */
466
+ replacement_html: string;
467
+ /**
468
+ */
469
+ start_utf16_codeunit: number;
470
+ }
471
+ /**
472
+ */
473
+ export class Selection {
474
+ free(): void;
475
+ /**
476
+ */
477
+ end_utf16_codeunit: number;
478
+ /**
479
+ */
480
+ start_utf16_codeunit: number;
481
+ }
482
+ /**
483
+ */
484
+ export class SuggestionPattern {
485
+ free(): void;
486
+ /**
487
+ */
488
+ end: number;
489
+ /**
490
+ */
491
+ key: PatternKey;
492
+ /**
493
+ */
494
+ start: number;
495
+ /**
496
+ */
497
+ text: string;
498
+ }
499
+ /**
500
+ */
501
+ export class TextUpdate {
502
+ free(): void;
503
+ /**
504
+ */
505
+ keep?: Keep;
506
+ /**
507
+ */
508
+ replace_all?: ReplaceAll;
509
+ /**
510
+ */
511
+ select?: Selection;
512
+ }