@ckeditor/ckeditor5-engine 48.2.0 → 48.3.0-alpha.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.
- package/dist/controller/datacontroller.d.ts +329 -328
- package/dist/controller/editingcontroller.d.ts +95 -94
- package/dist/conversion/comparemarkers.d.ts +45 -45
- package/dist/conversion/conversion.d.ts +474 -474
- package/dist/conversion/conversionhelpers.d.ts +21 -21
- package/dist/conversion/downcastdispatcher.d.ts +539 -538
- package/dist/conversion/downcasthelpers.d.ts +1129 -1129
- package/dist/conversion/mapper.d.ts +692 -697
- package/dist/conversion/modelconsumable.d.ts +196 -196
- package/dist/conversion/upcastdispatcher.d.ts +483 -482
- package/dist/conversion/upcasthelpers.d.ts +491 -491
- package/dist/conversion/viewconsumable.d.ts +330 -330
- package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
- package/dist/dataprocessor/dataprocessor.d.ts +57 -57
- package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
- package/dist/dataprocessor/htmlwriter.d.ts +11 -11
- package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
- package/dist/dev-utils/model.d.ts +128 -123
- package/dist/dev-utils/operationreplayer.d.ts +49 -49
- package/dist/dev-utils/utils.d.ts +33 -33
- package/dist/dev-utils/view.d.ts +314 -309
- package/dist/engineconfig.d.ts +39 -39
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +150 -150
- package/dist/index.js +34026 -40107
- package/dist/index.js.map +1 -1
- package/dist/legacyerrors.d.ts +0 -4
- package/dist/model/batch.d.ts +86 -86
- package/dist/model/differ.d.ts +504 -504
- package/dist/model/document.d.ts +265 -268
- package/dist/model/documentfragment.d.ts +214 -214
- package/dist/model/documentselection.d.ts +406 -410
- package/dist/model/element.d.ts +182 -182
- package/dist/model/history.d.ts +109 -109
- package/dist/model/item.d.ts +9 -9
- package/dist/model/liveposition.d.ts +70 -69
- package/dist/model/liverange.d.ts +93 -92
- package/dist/model/markercollection.d.ts +317 -324
- package/dist/model/model.d.ts +889 -909
- package/dist/model/node.d.ts +254 -254
- package/dist/model/nodelist.d.ts +110 -110
- package/dist/model/operation/attributeoperation.d.ts +98 -98
- package/dist/model/operation/detachoperation.d.ts +57 -57
- package/dist/model/operation/insertoperation.d.ts +85 -85
- package/dist/model/operation/markeroperation.d.ts +87 -87
- package/dist/model/operation/mergeoperation.d.ts +95 -95
- package/dist/model/operation/moveoperation.d.ts +97 -97
- package/dist/model/operation/nooperation.d.ts +33 -33
- package/dist/model/operation/operation.d.ts +94 -94
- package/dist/model/operation/operationfactory.d.ts +14 -14
- package/dist/model/operation/renameoperation.d.ts +78 -78
- package/dist/model/operation/rootattributeoperation.d.ts +93 -93
- package/dist/model/operation/rootoperation.d.ts +71 -71
- package/dist/model/operation/splitoperation.d.ts +104 -104
- package/dist/model/operation/transform.d.ts +91 -91
- package/dist/model/operation/utils.d.ts +58 -58
- package/dist/model/position.d.ts +535 -535
- package/dist/model/range.d.ts +458 -453
- package/dist/model/rootelement.d.ts +55 -55
- package/dist/model/schema.d.ts +1325 -1327
- package/dist/model/selection.d.ts +452 -471
- package/dist/model/text.d.ts +62 -62
- package/dist/model/textproxy.d.ts +140 -140
- package/dist/model/treewalker.d.ts +190 -190
- package/dist/model/typecheckable.d.ts +281 -281
- package/dist/model/utils/autoparagraphing.d.ts +29 -29
- package/dist/model/utils/deletecontent.d.ts +68 -68
- package/dist/model/utils/getselectedcontent.d.ts +27 -27
- package/dist/model/utils/insertcontent.d.ts +42 -42
- package/dist/model/utils/insertobject.d.ts +41 -41
- package/dist/model/utils/modifyselection.d.ts +44 -44
- package/dist/model/utils/selection-post-fixer.d.ts +71 -71
- package/dist/model/writer.d.ts +854 -854
- package/dist/view/attributeelement.d.ts +123 -123
- package/dist/view/containerelement.d.ts +49 -49
- package/dist/view/datatransfer.d.ts +70 -70
- package/dist/view/document.d.ts +175 -177
- package/dist/view/documentfragment.d.ts +158 -157
- package/dist/view/documentselection.d.ts +308 -307
- package/dist/view/domconverter.d.ts +612 -657
- package/dist/view/downcastwriter.d.ts +1006 -1006
- package/dist/view/editableelement.d.ts +64 -63
- package/dist/view/element.d.ts +754 -754
- package/dist/view/elementdefinition.d.ts +79 -79
- package/dist/view/emptyelement.d.ts +42 -42
- package/dist/view/filler.d.ts +75 -75
- package/dist/view/item.d.ts +9 -9
- package/dist/view/matcher.d.ts +412 -487
- package/dist/view/node.d.ts +164 -163
- package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
- package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
- package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
- package/dist/view/observer/clickobserver.d.ts +36 -36
- package/dist/view/observer/compositionobserver.d.ts +67 -67
- package/dist/view/observer/domeventdata.d.ts +46 -46
- package/dist/view/observer/domeventobserver.d.ts +77 -74
- package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
- package/dist/view/observer/focusobserver.d.ts +84 -84
- package/dist/view/observer/inputobserver.d.ts +76 -76
- package/dist/view/observer/keyobserver.d.ts +53 -53
- package/dist/view/observer/mouseobserver.d.ts +73 -73
- package/dist/view/observer/mutationobserver.d.ts +101 -101
- package/dist/view/observer/observer.d.ts +84 -83
- package/dist/view/observer/pointerobserver.d.ts +63 -63
- package/dist/view/observer/selectionobserver.d.ts +136 -136
- package/dist/view/observer/tabobserver.d.ts +38 -38
- package/dist/view/observer/touchobserver.d.ts +60 -60
- package/dist/view/placeholder.d.ts +80 -80
- package/dist/view/position.d.ts +187 -187
- package/dist/view/range.d.ts +282 -282
- package/dist/view/rawelement.d.ts +72 -72
- package/dist/view/renderer.d.ts +270 -272
- package/dist/view/rooteditableelement.d.ts +43 -43
- package/dist/view/selection.d.ts +356 -369
- package/dist/view/styles/background.d.ts +15 -15
- package/dist/view/styles/border.d.ts +27 -27
- package/dist/view/styles/margin.d.ts +12 -12
- package/dist/view/styles/padding.d.ts +12 -12
- package/dist/view/styles/utils.d.ts +72 -72
- package/dist/view/stylesmap.d.ts +715 -715
- package/dist/view/text.d.ts +75 -75
- package/dist/view/textproxy.d.ts +92 -92
- package/dist/view/tokenlist.d.ts +104 -104
- package/dist/view/treewalker.d.ts +201 -201
- package/dist/view/typecheckable.d.ts +445 -445
- package/dist/view/uielement.d.ts +93 -93
- package/dist/view/upcastwriter.d.ts +412 -412
- package/dist/view/view.d.ts +466 -469
- package/package.json +2 -2
package/dist/view/element.d.ts
CHANGED
|
@@ -1,767 +1,767 @@
|
|
|
1
1
|
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
* @license Copyright (c) 2003-2026, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
* For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-licensing-options
|
|
4
|
+
*/
|
|
5
5
|
/**
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
import { ViewNode } from
|
|
9
|
-
import { type ArrayOrItem } from
|
|
10
|
-
import { type MatcherPattern, type NormalizedPropertyPattern } from
|
|
11
|
-
import { type Styles, type StyleValue } from
|
|
12
|
-
import { type ViewDocument } from
|
|
13
|
-
import { type ViewItem } from
|
|
6
|
+
* @module engine/view/element
|
|
7
|
+
*/
|
|
8
|
+
import { ViewNode } from "./node.js";
|
|
9
|
+
import { type ArrayOrItem } from "@ckeditor/ckeditor5-utils";
|
|
10
|
+
import { type MatcherPattern, type NormalizedPropertyPattern } from "./matcher.js";
|
|
11
|
+
import { type Styles, type StyleValue } from "./stylesmap.js";
|
|
12
|
+
import { type ViewDocument } from "./document.js";
|
|
13
|
+
import { type ViewItem } from "./item.js";
|
|
14
14
|
/**
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
15
|
+
* View element.
|
|
16
|
+
*
|
|
17
|
+
* The editing engine does not define a fixed semantics of its elements (it is "DTD-free").
|
|
18
|
+
* This is why the type of the {@link module:engine/view/element~ViewElement} need to
|
|
19
|
+
* be defined by the feature developer. When creating an element you should use one of the following methods:
|
|
20
|
+
*
|
|
21
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createContainerElement `downcastWriter#createContainerElement()`}
|
|
22
|
+
* in order to create a {@link module:engine/view/containerelement~ViewContainerElement},
|
|
23
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createAttributeElement `downcastWriter#createAttributeElement()`}
|
|
24
|
+
* in order to create a {@link module:engine/view/attributeelement~ViewAttributeElement},
|
|
25
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEmptyElement `downcastWriter#createEmptyElement()`}
|
|
26
|
+
* in order to create a {@link module:engine/view/emptyelement~ViewEmptyElement}.
|
|
27
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createUIElement `downcastWriter#createUIElement()`}
|
|
28
|
+
* in order to create a {@link module:engine/view/uielement~ViewUIElement}.
|
|
29
|
+
* * {@link module:engine/view/downcastwriter~ViewDowncastWriter#createEditableElement `downcastWriter#createEditableElement()`}
|
|
30
|
+
* in order to create a {@link module:engine/view/editableelement~ViewEditableElement}.
|
|
31
|
+
*
|
|
32
|
+
* Note that for view elements which are not created from the model, like elements from mutations, paste or
|
|
33
|
+
* {@link module:engine/controller/datacontroller~DataController#set data.set} it is not possible to define the type of the element.
|
|
34
|
+
* In such cases the {@link module:engine/view/upcastwriter~ViewUpcastWriter#createElement `UpcastWriter#createElement()`} method
|
|
35
|
+
* should be used to create generic view elements.
|
|
36
|
+
*/
|
|
37
37
|
export declare class ViewElement extends ViewNode {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
38
|
+
/**
|
|
39
|
+
* Name of the element.
|
|
40
|
+
*/
|
|
41
|
+
readonly name: string;
|
|
42
|
+
/**
|
|
43
|
+
* A list of attribute names that should be rendered in the editing pipeline even though filtering mechanisms
|
|
44
|
+
* implemented in the {@link module:engine/view/domconverter~ViewDomConverter} (for instance,
|
|
45
|
+
* {@link module:engine/view/domconverter~ViewDomConverter#shouldRenderAttribute}) would filter them out.
|
|
46
|
+
*
|
|
47
|
+
* These attributes can be specified as an option when the element is created by
|
|
48
|
+
* the {@link module:engine/view/downcastwriter~ViewDowncastWriter}. To check whether an unsafe an attribute should
|
|
49
|
+
* be permitted, use the {@link #shouldRenderUnsafeAttribute} method.
|
|
50
|
+
*
|
|
51
|
+
* @internal
|
|
52
|
+
*/
|
|
53
|
+
readonly _unsafeAttributesToRender: Array<string>;
|
|
54
|
+
/**
|
|
55
|
+
* Map of attributes, where attributes names are keys and attributes values are values.
|
|
56
|
+
*/
|
|
57
|
+
private readonly _attrs;
|
|
58
|
+
/**
|
|
59
|
+
* Array of child nodes.
|
|
60
|
+
*/
|
|
61
|
+
private readonly _children;
|
|
62
|
+
/**
|
|
63
|
+
* Map of custom properties.
|
|
64
|
+
* Custom properties can be added to element instance, will be cloned but not rendered into DOM.
|
|
65
|
+
*/
|
|
66
|
+
private readonly _customProperties;
|
|
67
|
+
/**
|
|
68
|
+
* Set of classes associated with element instance.
|
|
69
|
+
*
|
|
70
|
+
* Note that this is just an alias for `this._attrs.get( 'class' );`
|
|
71
|
+
*/
|
|
72
|
+
private get _classes();
|
|
73
|
+
/**
|
|
74
|
+
* Normalized styles.
|
|
75
|
+
*
|
|
76
|
+
* Note that this is just an alias for `this._attrs.get( 'style' );`
|
|
77
|
+
*/
|
|
78
|
+
private get _styles();
|
|
79
|
+
/**
|
|
80
|
+
* Creates a view element.
|
|
81
|
+
*
|
|
82
|
+
* Attributes can be passed in various formats:
|
|
83
|
+
*
|
|
84
|
+
* ```ts
|
|
85
|
+
* new Element( viewDocument, 'div', { class: 'editor', contentEditable: 'true' } ); // object
|
|
86
|
+
* new Element( viewDocument, 'div', [ [ 'class', 'editor' ], [ 'contentEditable', 'true' ] ] ); // map-like iterator
|
|
87
|
+
* new Element( viewDocument, 'div', mapOfAttributes ); // map
|
|
88
|
+
* ```
|
|
89
|
+
*
|
|
90
|
+
* @internal
|
|
91
|
+
* @param document The document instance to which this element belongs.
|
|
92
|
+
* @param name Node name.
|
|
93
|
+
* @param attrs Collection of attributes.
|
|
94
|
+
* @param children A list of nodes to be inserted into created element.
|
|
95
|
+
*/
|
|
96
|
+
constructor(document: ViewDocument, name: string, attrs?: ViewElementAttributes, children?: ViewNode | Iterable<ViewNode>);
|
|
97
|
+
/**
|
|
98
|
+
* Number of element's children.
|
|
99
|
+
*/
|
|
100
|
+
get childCount(): number;
|
|
101
|
+
/**
|
|
102
|
+
* Is `true` if there are no nodes inside this element, `false` otherwise.
|
|
103
|
+
*/
|
|
104
|
+
get isEmpty(): boolean;
|
|
105
|
+
/**
|
|
106
|
+
* Gets child at the given index.
|
|
107
|
+
*
|
|
108
|
+
* @param index Index of child.
|
|
109
|
+
* @returns Child node.
|
|
110
|
+
*/
|
|
111
|
+
getChild(index: number): ViewNode | undefined;
|
|
112
|
+
/**
|
|
113
|
+
* Gets index of the given child node. Returns `-1` if child node is not found.
|
|
114
|
+
*
|
|
115
|
+
* @param node Child node.
|
|
116
|
+
* @returns Index of the child node.
|
|
117
|
+
*/
|
|
118
|
+
getChildIndex(node: ViewNode): number;
|
|
119
|
+
/**
|
|
120
|
+
* Gets child nodes iterator.
|
|
121
|
+
*
|
|
122
|
+
* @returns Child nodes iterator.
|
|
123
|
+
*/
|
|
124
|
+
getChildren(): IterableIterator<ViewNode>;
|
|
125
|
+
/**
|
|
126
|
+
* Returns an iterator that contains the keys for attributes. Order of inserting attributes is not preserved.
|
|
127
|
+
*
|
|
128
|
+
* @returns Keys for attributes.
|
|
129
|
+
*/
|
|
130
|
+
getAttributeKeys(): IterableIterator<string>;
|
|
131
|
+
/**
|
|
132
|
+
* Returns iterator that iterates over this element's attributes.
|
|
133
|
+
*
|
|
134
|
+
* Attributes are returned as arrays containing two items. First one is attribute key and second is attribute value.
|
|
135
|
+
* This format is accepted by native `Map` object and also can be passed in `Node` constructor.
|
|
136
|
+
*/
|
|
137
|
+
getAttributes(): IterableIterator<[string, string]>;
|
|
138
|
+
/**
|
|
139
|
+
* Gets attribute by key. If attribute is not present - returns undefined.
|
|
140
|
+
*
|
|
141
|
+
* @param key Attribute key.
|
|
142
|
+
* @returns Attribute value.
|
|
143
|
+
*/
|
|
144
|
+
getAttribute(key: string): string | undefined;
|
|
145
|
+
/**
|
|
146
|
+
* Returns a boolean indicating whether an attribute with the specified key exists in the element.
|
|
147
|
+
*
|
|
148
|
+
* @param key Attribute key.
|
|
149
|
+
* @returns `true` if attribute with the specified key exists in the element, `false` otherwise.
|
|
150
|
+
*/
|
|
151
|
+
hasAttribute(key: string, token?: string): boolean;
|
|
152
|
+
/**
|
|
153
|
+
* Checks if this element is similar to other element.
|
|
154
|
+
* Both elements should have the same name and attributes to be considered as similar. Two similar elements
|
|
155
|
+
* can contain different set of children nodes.
|
|
156
|
+
*/
|
|
157
|
+
isSimilar(otherElement: ViewItem): boolean;
|
|
158
|
+
/**
|
|
159
|
+
* Returns true if class is present.
|
|
160
|
+
* If more then one class is provided - returns true only when all classes are present.
|
|
161
|
+
*
|
|
162
|
+
* ```ts
|
|
163
|
+
* element.hasClass( 'foo' ); // Returns true if 'foo' class is present.
|
|
164
|
+
* element.hasClass( 'foo', 'bar' ); // Returns true if 'foo' and 'bar' classes are both present.
|
|
165
|
+
* ```
|
|
166
|
+
*/
|
|
167
|
+
hasClass(...className: Array<string>): boolean;
|
|
168
|
+
/**
|
|
169
|
+
* Returns iterator that contains all class names.
|
|
170
|
+
*/
|
|
171
|
+
getClassNames(): IterableIterator<string>;
|
|
172
|
+
/**
|
|
173
|
+
* Returns style value for the given property name.
|
|
174
|
+
* If the style does not exist `undefined` is returned.
|
|
175
|
+
*
|
|
176
|
+
* **Note**: This method can work with normalized style names if
|
|
177
|
+
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
178
|
+
* See {@link module:engine/view/stylesmap~StylesMap#getAsString `StylesMap#getAsString()`} for details.
|
|
179
|
+
*
|
|
180
|
+
* For an element with style set to `'margin:1px'`:
|
|
181
|
+
*
|
|
182
|
+
* ```ts
|
|
183
|
+
* // Enable 'margin' shorthand processing:
|
|
184
|
+
* editor.data.addStyleProcessorRules( addMarginStylesRules );
|
|
185
|
+
*
|
|
186
|
+
* const element = view.change( writer => {
|
|
187
|
+
* const element = writer.createElement();
|
|
188
|
+
* writer.setStyle( 'margin', '1px' );
|
|
189
|
+
* writer.setStyle( 'margin-bottom', '3em' );
|
|
190
|
+
*
|
|
191
|
+
* return element;
|
|
192
|
+
* } );
|
|
193
|
+
*
|
|
194
|
+
* element.getStyle( 'margin' ); // -> 'margin: 1px 1px 3em;'
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
getStyle(property: string): string | undefined;
|
|
198
|
+
/**
|
|
199
|
+
* Returns a normalized style object or single style value.
|
|
200
|
+
*
|
|
201
|
+
* For an element with style set to: margin:1px 2px 3em;
|
|
202
|
+
*
|
|
203
|
+
* ```ts
|
|
204
|
+
* element.getNormalizedStyle( 'margin' ) );
|
|
205
|
+
* ```
|
|
206
|
+
*
|
|
207
|
+
* will return:
|
|
208
|
+
*
|
|
209
|
+
* ```ts
|
|
210
|
+
* {
|
|
211
|
+
* top: '1px',
|
|
212
|
+
* right: '2px',
|
|
213
|
+
* bottom: '3em',
|
|
214
|
+
* left: '2px' // a normalized value from margin shorthand
|
|
215
|
+
* }
|
|
216
|
+
* ```
|
|
217
|
+
*
|
|
218
|
+
* and reading for single style value:
|
|
219
|
+
*
|
|
220
|
+
* ```ts
|
|
221
|
+
* styles.getNormalizedStyle( 'margin-left' );
|
|
222
|
+
* ```
|
|
223
|
+
*
|
|
224
|
+
* Will return a `2px` string.
|
|
225
|
+
*
|
|
226
|
+
* **Note**: This method will return normalized values only if
|
|
227
|
+
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
228
|
+
* See {@link module:engine/view/stylesmap~StylesMap#getNormalized `StylesMap#getNormalized()`} for details.
|
|
229
|
+
*
|
|
230
|
+
* @param property Name of CSS property
|
|
231
|
+
*/
|
|
232
|
+
getNormalizedStyle(property: string): StyleValue | undefined;
|
|
233
|
+
/**
|
|
234
|
+
* Returns an array that contains all style names.
|
|
235
|
+
*
|
|
236
|
+
* @param expand Expand shorthand style properties and return all equivalent style representations.
|
|
237
|
+
*/
|
|
238
|
+
getStyleNames(expand?: boolean): Array<string>;
|
|
239
|
+
/**
|
|
240
|
+
* Returns true if style keys are present.
|
|
241
|
+
* If more then one style property is provided - returns true only when all properties are present.
|
|
242
|
+
*
|
|
243
|
+
* ```ts
|
|
244
|
+
* element.hasStyle( 'color' ); // Returns true if 'border-top' style is present.
|
|
245
|
+
* element.hasStyle( 'color', 'border-top' ); // Returns true if 'color' and 'border-top' styles are both present.
|
|
246
|
+
* ```
|
|
247
|
+
*/
|
|
248
|
+
hasStyle(...property: Array<string>): boolean;
|
|
249
|
+
/**
|
|
250
|
+
* Returns ancestor element that match specified pattern.
|
|
251
|
+
* Provided patterns should be compatible with {@link module:engine/view/matcher~Matcher Matcher} as it is used internally.
|
|
252
|
+
*
|
|
253
|
+
* @see module:engine/view/matcher~Matcher
|
|
254
|
+
* @param patterns Patterns used to match correct ancestor. See {@link module:engine/view/matcher~Matcher}.
|
|
255
|
+
* @returns Found element or `null` if no matching ancestor was found.
|
|
256
|
+
*/
|
|
257
|
+
findAncestor(...patterns: Array<MatcherPattern | ((element: ViewElement) => boolean)>): ViewElement | null;
|
|
258
|
+
/**
|
|
259
|
+
* Returns the custom property value for the given key.
|
|
260
|
+
*/
|
|
261
|
+
getCustomProperty(key: string | symbol): unknown;
|
|
262
|
+
/**
|
|
263
|
+
* Returns an iterator which iterates over this element's custom properties.
|
|
264
|
+
* Iterator provides `[ key, value ]` pairs for each stored property.
|
|
265
|
+
*/
|
|
266
|
+
getCustomProperties(): IterableIterator<[string | symbol, unknown]>;
|
|
267
|
+
/**
|
|
268
|
+
* Returns identity string based on element's name, styles, classes and other attributes.
|
|
269
|
+
* Two elements that {@link #isSimilar are similar} will have same identity string.
|
|
270
|
+
* It has the following format:
|
|
271
|
+
*
|
|
272
|
+
* ```ts
|
|
273
|
+
* 'name class="class1,class2" style="style1:value1;style2:value2" attr1="val1" attr2="val2"'
|
|
274
|
+
* ```
|
|
275
|
+
*
|
|
276
|
+
* For example:
|
|
277
|
+
*
|
|
278
|
+
* ```ts
|
|
279
|
+
* const element = writer.createContainerElement( 'foo', {
|
|
280
|
+
* banana: '10',
|
|
281
|
+
* apple: '20',
|
|
282
|
+
* style: 'color: red; border-color: white;',
|
|
283
|
+
* class: 'baz'
|
|
284
|
+
* } );
|
|
285
|
+
*
|
|
286
|
+
* // returns 'foo class="baz" style="border-color:white;color:red" apple="20" banana="10"'
|
|
287
|
+
* element.getIdentity();
|
|
288
|
+
* ```
|
|
289
|
+
*
|
|
290
|
+
* **Note**: Classes, styles and other attributes are sorted alphabetically.
|
|
291
|
+
*/
|
|
292
|
+
getIdentity(): string;
|
|
293
|
+
/**
|
|
294
|
+
* Decides whether an unsafe attribute is whitelisted and should be rendered in the editing pipeline even though filtering mechanisms
|
|
295
|
+
* like {@link module:engine/view/domconverter~ViewDomConverter#shouldRenderAttribute} say it should not.
|
|
296
|
+
*
|
|
297
|
+
* Unsafe attribute names can be specified when creating an element via {@link module:engine/view/downcastwriter~ViewDowncastWriter}.
|
|
298
|
+
*
|
|
299
|
+
* @param attributeName The name of the attribute to be checked.
|
|
300
|
+
*/
|
|
301
|
+
shouldRenderUnsafeAttribute(attributeName: string): boolean;
|
|
302
|
+
/**
|
|
303
|
+
* Converts `ViewElement` to plain object and returns it.
|
|
304
|
+
*
|
|
305
|
+
* @returns `ViewElement` converted to plain object.
|
|
306
|
+
*/
|
|
307
|
+
override toJSON(): unknown;
|
|
308
|
+
/**
|
|
309
|
+
* Clones provided element.
|
|
310
|
+
*
|
|
311
|
+
* @internal
|
|
312
|
+
* @param deep If set to `true` clones element and all its children recursively. When set to `false`,
|
|
313
|
+
* element will be cloned without any children.
|
|
314
|
+
* @returns Clone of this element.
|
|
315
|
+
*/
|
|
316
|
+
_clone(deep?: boolean): this;
|
|
317
|
+
/**
|
|
318
|
+
* {@link module:engine/view/element~ViewElement#_insertChild Insert} a child node or a list of child nodes at the end of this node
|
|
319
|
+
* and sets the parent of these nodes to this element.
|
|
320
|
+
*
|
|
321
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#insert
|
|
322
|
+
* @internal
|
|
323
|
+
* @param items Items to be inserted.
|
|
324
|
+
* @fires change
|
|
325
|
+
* @returns Number of appended nodes.
|
|
326
|
+
*/
|
|
327
|
+
_appendChild(items: ViewItem | string | Iterable<ViewItem | string>): number;
|
|
328
|
+
/**
|
|
329
|
+
* Inserts a child node or a list of child nodes on the given index and sets the parent of these nodes to
|
|
330
|
+
* this element.
|
|
331
|
+
*
|
|
332
|
+
* @internal
|
|
333
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#insert
|
|
334
|
+
* @param index Position where nodes should be inserted.
|
|
335
|
+
* @param items Items to be inserted.
|
|
336
|
+
* @fires change
|
|
337
|
+
* @returns Number of inserted nodes.
|
|
338
|
+
*/
|
|
339
|
+
_insertChild(index: number, items: ViewItem | string | Iterable<ViewItem | string>): number;
|
|
340
|
+
/**
|
|
341
|
+
* Removes number of child nodes starting at the given index and set the parent of these nodes to `null`.
|
|
342
|
+
*
|
|
343
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#remove
|
|
344
|
+
* @internal
|
|
345
|
+
* @param index Number of the first node to remove.
|
|
346
|
+
* @param howMany Number of nodes to remove.
|
|
347
|
+
* @fires change
|
|
348
|
+
* @returns The array of removed nodes.
|
|
349
|
+
*/
|
|
350
|
+
_removeChildren(index: number, howMany?: number): Array<ViewNode>;
|
|
351
|
+
/**
|
|
352
|
+
* Adds or overwrite attribute with a specified key and value.
|
|
353
|
+
*
|
|
354
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#setAttribute
|
|
355
|
+
* @internal
|
|
356
|
+
* @param key Attribute key.
|
|
357
|
+
* @param value Attribute value.
|
|
358
|
+
* @param overwrite Whether tokenized attribute should override the attribute value or just add a token.
|
|
359
|
+
* @fires change
|
|
360
|
+
*/
|
|
361
|
+
_setAttribute(key: string, value: unknown, overwrite?: boolean): void;
|
|
362
|
+
/**
|
|
363
|
+
* Removes attribute from the element.
|
|
364
|
+
*
|
|
365
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#removeAttribute
|
|
366
|
+
* @internal
|
|
367
|
+
* @param key Attribute key.
|
|
368
|
+
* @param tokens Attribute value tokens to remove. The whole attribute is removed if not specified.
|
|
369
|
+
* @returns Returns true if an attribute existed and has been removed.
|
|
370
|
+
* @fires change
|
|
371
|
+
*/
|
|
372
|
+
_removeAttribute(key: string, tokens?: ArrayOrItem<string>): boolean;
|
|
373
|
+
/**
|
|
374
|
+
* Adds specified class.
|
|
375
|
+
*
|
|
376
|
+
* ```ts
|
|
377
|
+
* element._addClass( 'foo' ); // Adds 'foo' class.
|
|
378
|
+
* element._addClass( [ 'foo', 'bar' ] ); // Adds 'foo' and 'bar' classes.
|
|
379
|
+
* ```
|
|
380
|
+
*
|
|
381
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#addClass
|
|
382
|
+
* @internal
|
|
383
|
+
* @fires change
|
|
384
|
+
*/
|
|
385
|
+
_addClass(className: ArrayOrItem<string>): void;
|
|
386
|
+
/**
|
|
387
|
+
* Removes specified class.
|
|
388
|
+
*
|
|
389
|
+
* ```ts
|
|
390
|
+
* element._removeClass( 'foo' ); // Removes 'foo' class.
|
|
391
|
+
* element._removeClass( [ 'foo', 'bar' ] ); // Removes both 'foo' and 'bar' classes.
|
|
392
|
+
* ```
|
|
393
|
+
*
|
|
394
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#removeClass
|
|
395
|
+
* @internal
|
|
396
|
+
* @fires change
|
|
397
|
+
*/
|
|
398
|
+
_removeClass(className: ArrayOrItem<string>): void;
|
|
399
|
+
/**
|
|
400
|
+
* Adds style to the element.
|
|
401
|
+
*
|
|
402
|
+
* ```ts
|
|
403
|
+
* element._setStyle( 'color', 'red' );
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* **Note**: This method can work with normalized style names if
|
|
407
|
+
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
408
|
+
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
409
|
+
*
|
|
410
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#setStyle
|
|
411
|
+
* @label KEY_VALUE
|
|
412
|
+
* @internal
|
|
413
|
+
* @param property Property name.
|
|
414
|
+
* @param value Value to set.
|
|
415
|
+
* @fires change
|
|
416
|
+
*/
|
|
417
|
+
_setStyle(property: string, value: StyleValue): void;
|
|
418
|
+
/**
|
|
419
|
+
* Adds style to the element.
|
|
420
|
+
*
|
|
421
|
+
* ```ts
|
|
422
|
+
* element._setStyle( {
|
|
423
|
+
* color: 'red',
|
|
424
|
+
* position: 'fixed'
|
|
425
|
+
* } );
|
|
426
|
+
* ```
|
|
427
|
+
*
|
|
428
|
+
* **Note**: This method can work with normalized style names if
|
|
429
|
+
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
430
|
+
* See {@link module:engine/view/stylesmap~StylesMap#set `StylesMap#set()`} for details.
|
|
431
|
+
*
|
|
432
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#setStyle
|
|
433
|
+
* @label OBJECT
|
|
434
|
+
* @internal
|
|
435
|
+
* @param properties Object with key - value pairs.
|
|
436
|
+
* @fires change
|
|
437
|
+
*/
|
|
438
|
+
_setStyle(properties: Record<string, StyleValue>): void;
|
|
439
|
+
/**
|
|
440
|
+
* Removes specified style.
|
|
441
|
+
*
|
|
442
|
+
* ```ts
|
|
443
|
+
* element._removeStyle( 'color' ); // Removes 'color' style.
|
|
444
|
+
* element._removeStyle( [ 'color', 'border-top' ] ); // Removes both 'color' and 'border-top' styles.
|
|
445
|
+
* ```
|
|
446
|
+
*
|
|
447
|
+
* **Note**: This method can work with normalized style names if
|
|
448
|
+
* {@link module:engine/controller/datacontroller~DataController#addStyleProcessorRules a particular style processor rule is enabled}.
|
|
449
|
+
* See {@link module:engine/view/stylesmap~StylesMap#remove `StylesMap#remove()`} for details.
|
|
450
|
+
*
|
|
451
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#removeStyle
|
|
452
|
+
* @internal
|
|
453
|
+
* @fires change
|
|
454
|
+
*/
|
|
455
|
+
_removeStyle(property: ArrayOrItem<string>): void;
|
|
456
|
+
/**
|
|
457
|
+
* Used by the {@link module:engine/view/matcher~Matcher Matcher} to collect matching attribute tuples
|
|
458
|
+
* (attribute name and optional token).
|
|
459
|
+
*
|
|
460
|
+
* Normalized patterns can be used in following ways:
|
|
461
|
+
* - to match any attribute name with any or no value:
|
|
462
|
+
*
|
|
463
|
+
* ```ts
|
|
464
|
+
* patterns: [
|
|
465
|
+
* [ true, true ]
|
|
466
|
+
* ]
|
|
467
|
+
* ```
|
|
468
|
+
*
|
|
469
|
+
* - to match a specific attribute with any value:
|
|
470
|
+
*
|
|
471
|
+
* ```ts
|
|
472
|
+
* patterns: [
|
|
473
|
+
* [ 'required', true ]
|
|
474
|
+
* ]
|
|
475
|
+
* ```
|
|
476
|
+
*
|
|
477
|
+
* - to match an attribute name with a RegExp with any value:
|
|
478
|
+
*
|
|
479
|
+
* ```ts
|
|
480
|
+
* patterns: [
|
|
481
|
+
* [ /h[1-6]/, true ]
|
|
482
|
+
* ]
|
|
483
|
+
* ```
|
|
484
|
+
*
|
|
485
|
+
* - to match a specific attribute with the exact value:
|
|
486
|
+
*
|
|
487
|
+
* ```ts
|
|
488
|
+
* patterns: [
|
|
489
|
+
* [ 'rel', 'nofollow' ]
|
|
490
|
+
* ]
|
|
491
|
+
* ```
|
|
492
|
+
*
|
|
493
|
+
* - to match a specific attribute with a value matching a RegExp:
|
|
494
|
+
*
|
|
495
|
+
* ```ts
|
|
496
|
+
* patterns: [
|
|
497
|
+
* [ 'src', /^https/ ]
|
|
498
|
+
* ]
|
|
499
|
+
* ```
|
|
500
|
+
*
|
|
501
|
+
* - to match an attribute name with a RegExp and the exact value:
|
|
502
|
+
*
|
|
503
|
+
* ```ts
|
|
504
|
+
* patterns: [
|
|
505
|
+
* [ /^data-property-/, 'foobar' ],
|
|
506
|
+
* ]
|
|
507
|
+
* ```
|
|
508
|
+
*
|
|
509
|
+
* - to match an attribute name with a RegExp and match a value with another RegExp:
|
|
510
|
+
*
|
|
511
|
+
* ```ts
|
|
512
|
+
* patterns: [
|
|
513
|
+
* [ /^data-property-/, /^foo/ ]
|
|
514
|
+
* ]
|
|
515
|
+
* ```
|
|
516
|
+
*
|
|
517
|
+
* - to match a specific style property with the value matching a RegExp:
|
|
518
|
+
*
|
|
519
|
+
* ```ts
|
|
520
|
+
* patterns: [
|
|
521
|
+
* [ 'style', 'font-size', /px$/ ]
|
|
522
|
+
* ]
|
|
523
|
+
* ```
|
|
524
|
+
*
|
|
525
|
+
* - to match a specific class (class attribute is tokenized so it matches tokens individually):
|
|
526
|
+
*
|
|
527
|
+
* ```ts
|
|
528
|
+
* patterns: [
|
|
529
|
+
* [ 'class', 'foo' ]
|
|
530
|
+
* ]
|
|
531
|
+
* ```
|
|
532
|
+
*
|
|
533
|
+
* @internal
|
|
534
|
+
* @param patterns An array of normalized patterns (tuples of 2 or 3 items depending on if tokenized attribute value match is needed).
|
|
535
|
+
* @param match An array to populate with matching tuples.
|
|
536
|
+
* @param exclude Array of attribute names to exclude from match.
|
|
537
|
+
* @returns `true` if element matches all patterns. The matching tuples are pushed to the `match` array.
|
|
538
|
+
*/
|
|
539
|
+
_collectAttributesMatch(patterns: Array<NormalizedPropertyPattern>, match: Array<[string, string?]>, exclude?: Array<string>): boolean;
|
|
540
|
+
/**
|
|
541
|
+
* Used by the {@link module:engine/conversion/viewconsumable~ViewConsumable} to collect the
|
|
542
|
+
* {@link module:engine/view/element~ViewNormalizedConsumables} for the element.
|
|
543
|
+
*
|
|
544
|
+
* When `key` and `token` parameters are provided the output is filtered for the specified attribute and it's tokens and related tokens.
|
|
545
|
+
*
|
|
546
|
+
* @internal
|
|
547
|
+
* @param key Attribute name.
|
|
548
|
+
* @param token Reference token to collect all related tokens.
|
|
549
|
+
*/
|
|
550
|
+
_getConsumables(key?: string, token?: string): ViewNormalizedConsumables;
|
|
551
|
+
/**
|
|
552
|
+
* Verify if the given element can be merged without conflicts into the element.
|
|
553
|
+
*
|
|
554
|
+
* Note that this method is extended by the {@link module:engine/view/attributeelement~ViewAttributeElement} implementation.
|
|
555
|
+
*
|
|
556
|
+
* This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
557
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
558
|
+
*
|
|
559
|
+
* @internal
|
|
560
|
+
* @returns Returns `true` if elements can be merged.
|
|
561
|
+
*/
|
|
562
|
+
_canMergeAttributesFrom(otherElement: ViewElement): boolean;
|
|
563
|
+
/**
|
|
564
|
+
* Merges attributes of a given element into the element.
|
|
565
|
+
* This includes also tokenized attributes like style and class.
|
|
566
|
+
*
|
|
567
|
+
* Note that you should make sure there are no conflicts before merging (see {@link #_canMergeAttributesFrom}).
|
|
568
|
+
*
|
|
569
|
+
* This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
570
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
571
|
+
*
|
|
572
|
+
* @internal
|
|
573
|
+
*/
|
|
574
|
+
_mergeAttributesFrom(otherElement: ViewElement): void;
|
|
575
|
+
/**
|
|
576
|
+
* Verify if the given element attributes can be fully subtracted from the element.
|
|
577
|
+
*
|
|
578
|
+
* Note that this method is extended by the {@link module:engine/view/attributeelement~ViewAttributeElement} implementation.
|
|
579
|
+
*
|
|
580
|
+
* This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
581
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
|
|
582
|
+
*
|
|
583
|
+
* @internal
|
|
584
|
+
* @returns Returns `true` if elements attributes can be fully subtracted.
|
|
585
|
+
*/
|
|
586
|
+
_canSubtractAttributesOf(otherElement: ViewElement): boolean;
|
|
587
|
+
/**
|
|
588
|
+
* Removes (subtracts) corresponding attributes of the given element from the element.
|
|
589
|
+
* This includes also tokenized attributes like style and class.
|
|
590
|
+
* All attributes, classes and styles from given element should be present inside the element being unwrapped.
|
|
591
|
+
*
|
|
592
|
+
* Note that you should make sure all attributes could be subtracted before subtracting them (see {@link #_canSubtractAttributesOf}).
|
|
593
|
+
*
|
|
594
|
+
* This method is used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
595
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
|
|
596
|
+
*
|
|
597
|
+
* @internal
|
|
598
|
+
*/
|
|
599
|
+
_subtractAttributesOf(otherElement: ViewElement): void;
|
|
600
|
+
/**
|
|
601
|
+
* Sets a custom property. Unlike attributes, custom properties are not rendered to the DOM,
|
|
602
|
+
* so they can be used to add special data to elements.
|
|
603
|
+
*
|
|
604
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#setCustomProperty
|
|
605
|
+
* @internal
|
|
606
|
+
*/
|
|
607
|
+
_setCustomProperty(key: string | symbol, value: unknown): void;
|
|
608
|
+
/**
|
|
609
|
+
* Removes the custom property stored under the given key.
|
|
610
|
+
*
|
|
611
|
+
* @see module:engine/view/downcastwriter~ViewDowncastWriter#removeCustomProperty
|
|
612
|
+
* @internal
|
|
613
|
+
* @returns Returns true if property was removed.
|
|
614
|
+
*/
|
|
615
|
+
_removeCustomProperty(key: string | symbol): boolean;
|
|
616
|
+
/**
|
|
617
|
+
* Parses attributes provided to the element constructor before they are applied to an element. If attributes are passed
|
|
618
|
+
* as an object (instead of `Iterable`), the object is transformed to the map. Attributes with `null` value are removed.
|
|
619
|
+
* Attributes with non-`String` value are converted to `String`.
|
|
620
|
+
*
|
|
621
|
+
* @param attrs Attributes to parse.
|
|
622
|
+
* @returns Parsed attributes.
|
|
623
|
+
*/
|
|
624
|
+
private _parseAttributes;
|
|
625
|
+
/**
|
|
626
|
+
* Returns block {@link module:engine/view/filler filler} offset or `null` if block filler is not needed.
|
|
627
|
+
*/
|
|
628
|
+
getFillerOffset?(): number | null;
|
|
629
629
|
}
|
|
630
630
|
/**
|
|
631
|
-
|
|
632
|
-
|
|
631
|
+
* Common interface for a {@link module:engine/view/tokenlist~ViewTokenList} and {@link module:engine/view/stylesmap~StylesMap}.
|
|
632
|
+
*/
|
|
633
633
|
export interface ViewElementAttributeValue {
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
634
|
+
/**
|
|
635
|
+
* Returns `true` if attribute has no value set.
|
|
636
|
+
*/
|
|
637
|
+
get isEmpty(): boolean;
|
|
638
|
+
/**
|
|
639
|
+
* Number of tokens (styles, classes or other tokens) defined.
|
|
640
|
+
*/
|
|
641
|
+
get size(): number;
|
|
642
|
+
/**
|
|
643
|
+
* Checks if a given token (style, class, token) is set.
|
|
644
|
+
*/
|
|
645
|
+
has(name: string): boolean;
|
|
646
|
+
/**
|
|
647
|
+
* Returns all tokens (styles, classes, other tokens).
|
|
648
|
+
*/
|
|
649
|
+
keys(): Array<string>;
|
|
650
|
+
/**
|
|
651
|
+
* Resets the value to the given one.
|
|
652
|
+
*/
|
|
653
|
+
setTo(value: string): this;
|
|
654
|
+
/**
|
|
655
|
+
* Sets a given style property and value.
|
|
656
|
+
*/
|
|
657
|
+
set(name: string, value: StyleValue): void;
|
|
658
|
+
/**
|
|
659
|
+
* Sets a given token (for style also a record of properties).
|
|
660
|
+
*/
|
|
661
|
+
set(stylesOrTokens: Styles | ArrayOrItem<string>): void;
|
|
662
|
+
/**
|
|
663
|
+
* Removes given token (style, class, other token).
|
|
664
|
+
*/
|
|
665
|
+
remove(tokens: ArrayOrItem<string>): void;
|
|
666
|
+
/**
|
|
667
|
+
* Removes all tokens.
|
|
668
|
+
*/
|
|
669
|
+
clear(): void;
|
|
670
|
+
/**
|
|
671
|
+
* Returns a normalized tokens string (styles, classes, etc.).
|
|
672
|
+
*/
|
|
673
|
+
toString(): string;
|
|
674
|
+
/**
|
|
675
|
+
* Returns `true` if both attributes have the same content.
|
|
676
|
+
*/
|
|
677
|
+
isSimilar(other: this): boolean;
|
|
678
|
+
/**
|
|
679
|
+
* Clones the attribute value.
|
|
680
|
+
*/
|
|
681
|
+
_clone(): this;
|
|
682
|
+
/**
|
|
683
|
+
* Used by the {@link module:engine/view/matcher~Matcher Matcher} to collect matching attribute tokens.
|
|
684
|
+
*
|
|
685
|
+
* @param tokenPattern The matched token name pattern.
|
|
686
|
+
* @param valuePattern The matched token value pattern.
|
|
687
|
+
* @returns An array of matching tokens.
|
|
688
|
+
*/
|
|
689
|
+
_getTokensMatch(tokenPattern: true | string | RegExp, valuePattern?: true | string | RegExp): Array<string> | undefined;
|
|
690
|
+
/**
|
|
691
|
+
* Returns a list of consumables for the attribute. This includes related tokens
|
|
692
|
+
* (for example other forms of notation of the same style property).
|
|
693
|
+
*
|
|
694
|
+
* Could be filtered by the given token name (class name, style property, etc.).
|
|
695
|
+
*/
|
|
696
|
+
_getConsumables(name?: string): Array<string>;
|
|
697
|
+
/**
|
|
698
|
+
* Used by {@link ~ViewElement#_canMergeAttributesFrom} to verify if the given attribute can be merged without
|
|
699
|
+
* conflicts into the attribute.
|
|
700
|
+
*
|
|
701
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
702
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
703
|
+
*/
|
|
704
|
+
_canMergeFrom(other: this): boolean;
|
|
705
|
+
/**
|
|
706
|
+
* Used by {@link ~ViewElement#_mergeAttributesFrom} to merge a given attribute into the attribute.
|
|
707
|
+
*
|
|
708
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
709
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to merge it with other ViewAttributeElement.
|
|
710
|
+
*/
|
|
711
|
+
_mergeFrom(other: this): void;
|
|
712
|
+
/**
|
|
713
|
+
* Used by {@link ~ViewElement#_canSubtractAttributesOf} to verify if the given attribute can be fully subtracted from the attribute.
|
|
714
|
+
*
|
|
715
|
+
* This method is indirectly used by the {@link module:engine/view/downcastwriter~ViewDowncastWriter} while down-casting
|
|
716
|
+
* an {@link module:engine/view/attributeelement~ViewAttributeElement} to unwrap the ViewAttributeElement.
|
|
717
|
+
*/
|
|
718
|
+
_isMatching(other: this): boolean;
|
|
719
719
|
}
|
|
720
720
|
/**
|
|
721
|
-
|
|
722
|
-
|
|
721
|
+
* Collection of attributes.
|
|
722
|
+
*/
|
|
723
723
|
export type ViewElementAttributes = Record<string, unknown> | Iterable<[string, unknown]> | null;
|
|
724
724
|
/**
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
725
|
+
* Object describing all features of a view element that could be consumed and converted individually.
|
|
726
|
+
* This is a normalized form of {@link module:engine/conversion/viewconsumable~Consumables} generated from the view Element.
|
|
727
|
+
*
|
|
728
|
+
* Example element:
|
|
729
|
+
*
|
|
730
|
+
* ```html
|
|
731
|
+
* <a class="foo bar" style="color: red; margin: 5px" href="https://ckeditor.com" rel="nofollow noreferrer" target="_blank">
|
|
732
|
+
* ```
|
|
733
|
+
*
|
|
734
|
+
* The `ViewNormalizedConsumables` would include:
|
|
735
|
+
*
|
|
736
|
+
* ```json
|
|
737
|
+
* {
|
|
738
|
+
* name: true,
|
|
739
|
+
* attributes: [
|
|
740
|
+
* [ "class", "foo" ],
|
|
741
|
+
* [ "class", "bar" ],
|
|
742
|
+
* [ "style", "color" ],
|
|
743
|
+
* [ "style", "margin-top" ],
|
|
744
|
+
* [ "style", "margin-right" ],
|
|
745
|
+
* [ "style", "margin-bottom" ],
|
|
746
|
+
* [ "style", "margin-left" ],
|
|
747
|
+
[ "style", "margin" ],
|
|
748
|
+
* [ "href" ],
|
|
749
|
+
* [ "rel", "nofollow" ],
|
|
750
|
+
* [ "rel", "noreferrer" ],
|
|
751
|
+
* [ "target" ]
|
|
752
|
+
* ]
|
|
753
|
+
* }
|
|
754
|
+
* ```
|
|
755
|
+
*/
|
|
756
756
|
export interface ViewNormalizedConsumables {
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
757
|
+
/**
|
|
758
|
+
* If set to `true` element's name will be included in a consumable.
|
|
759
|
+
* Depending on the usage context it would be added as consumable, tested for being available for consume or consumed.
|
|
760
|
+
*/
|
|
761
|
+
name: boolean;
|
|
762
|
+
/**
|
|
763
|
+
* Array of tuples - an attribute name, and optional token for tokenized attributes.
|
|
764
|
+
* Note that there could be multiple entries for the same attribute with different tokens (class names or style properties).
|
|
765
|
+
*/
|
|
766
|
+
attributes: Array<[string, string?]>;
|
|
767
767
|
}
|