@ckeditor/ckeditor5-engine 48.2.0 → 48.3.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.
Files changed (129) hide show
  1. package/dist/controller/datacontroller.d.ts +329 -328
  2. package/dist/controller/editingcontroller.d.ts +95 -94
  3. package/dist/conversion/comparemarkers.d.ts +45 -45
  4. package/dist/conversion/conversion.d.ts +474 -474
  5. package/dist/conversion/conversionhelpers.d.ts +21 -21
  6. package/dist/conversion/downcastdispatcher.d.ts +539 -538
  7. package/dist/conversion/downcasthelpers.d.ts +1129 -1129
  8. package/dist/conversion/mapper.d.ts +692 -697
  9. package/dist/conversion/modelconsumable.d.ts +196 -196
  10. package/dist/conversion/upcastdispatcher.d.ts +483 -482
  11. package/dist/conversion/upcasthelpers.d.ts +491 -491
  12. package/dist/conversion/viewconsumable.d.ts +330 -330
  13. package/dist/dataprocessor/basichtmlwriter.d.ts +15 -15
  14. package/dist/dataprocessor/dataprocessor.d.ts +57 -57
  15. package/dist/dataprocessor/htmldataprocessor.d.ts +72 -72
  16. package/dist/dataprocessor/htmlwriter.d.ts +11 -11
  17. package/dist/dataprocessor/xmldataprocessor.d.ts +86 -86
  18. package/dist/dev-utils/model.d.ts +128 -123
  19. package/dist/dev-utils/operationreplayer.d.ts +49 -49
  20. package/dist/dev-utils/utils.d.ts +33 -33
  21. package/dist/dev-utils/view.d.ts +314 -309
  22. package/dist/engineconfig.d.ts +39 -39
  23. package/dist/index.css.map +1 -1
  24. package/dist/index.d.ts +150 -150
  25. package/dist/index.js +34026 -40107
  26. package/dist/index.js.map +1 -1
  27. package/dist/legacyerrors.d.ts +0 -4
  28. package/dist/model/batch.d.ts +86 -86
  29. package/dist/model/differ.d.ts +504 -504
  30. package/dist/model/document.d.ts +265 -268
  31. package/dist/model/documentfragment.d.ts +214 -214
  32. package/dist/model/documentselection.d.ts +406 -410
  33. package/dist/model/element.d.ts +182 -182
  34. package/dist/model/history.d.ts +109 -109
  35. package/dist/model/item.d.ts +9 -9
  36. package/dist/model/liveposition.d.ts +70 -69
  37. package/dist/model/liverange.d.ts +93 -92
  38. package/dist/model/markercollection.d.ts +317 -324
  39. package/dist/model/model.d.ts +889 -909
  40. package/dist/model/node.d.ts +254 -254
  41. package/dist/model/nodelist.d.ts +110 -110
  42. package/dist/model/operation/attributeoperation.d.ts +98 -98
  43. package/dist/model/operation/detachoperation.d.ts +57 -57
  44. package/dist/model/operation/insertoperation.d.ts +85 -85
  45. package/dist/model/operation/markeroperation.d.ts +87 -87
  46. package/dist/model/operation/mergeoperation.d.ts +95 -95
  47. package/dist/model/operation/moveoperation.d.ts +97 -97
  48. package/dist/model/operation/nooperation.d.ts +33 -33
  49. package/dist/model/operation/operation.d.ts +94 -94
  50. package/dist/model/operation/operationfactory.d.ts +14 -14
  51. package/dist/model/operation/renameoperation.d.ts +78 -78
  52. package/dist/model/operation/rootattributeoperation.d.ts +93 -93
  53. package/dist/model/operation/rootoperation.d.ts +71 -71
  54. package/dist/model/operation/splitoperation.d.ts +104 -104
  55. package/dist/model/operation/transform.d.ts +91 -91
  56. package/dist/model/operation/utils.d.ts +58 -58
  57. package/dist/model/position.d.ts +535 -535
  58. package/dist/model/range.d.ts +458 -453
  59. package/dist/model/rootelement.d.ts +55 -55
  60. package/dist/model/schema.d.ts +1325 -1327
  61. package/dist/model/selection.d.ts +452 -471
  62. package/dist/model/text.d.ts +62 -62
  63. package/dist/model/textproxy.d.ts +140 -140
  64. package/dist/model/treewalker.d.ts +190 -190
  65. package/dist/model/typecheckable.d.ts +281 -281
  66. package/dist/model/utils/autoparagraphing.d.ts +29 -29
  67. package/dist/model/utils/deletecontent.d.ts +68 -68
  68. package/dist/model/utils/getselectedcontent.d.ts +27 -27
  69. package/dist/model/utils/insertcontent.d.ts +42 -42
  70. package/dist/model/utils/insertobject.d.ts +41 -41
  71. package/dist/model/utils/modifyselection.d.ts +44 -44
  72. package/dist/model/utils/selection-post-fixer.d.ts +71 -71
  73. package/dist/model/writer.d.ts +854 -854
  74. package/dist/view/attributeelement.d.ts +123 -123
  75. package/dist/view/containerelement.d.ts +49 -49
  76. package/dist/view/datatransfer.d.ts +70 -70
  77. package/dist/view/document.d.ts +175 -177
  78. package/dist/view/documentfragment.d.ts +158 -157
  79. package/dist/view/documentselection.d.ts +308 -307
  80. package/dist/view/domconverter.d.ts +612 -657
  81. package/dist/view/downcastwriter.d.ts +1006 -1006
  82. package/dist/view/editableelement.d.ts +64 -63
  83. package/dist/view/element.d.ts +754 -754
  84. package/dist/view/elementdefinition.d.ts +79 -79
  85. package/dist/view/emptyelement.d.ts +42 -42
  86. package/dist/view/filler.d.ts +75 -75
  87. package/dist/view/item.d.ts +9 -9
  88. package/dist/view/matcher.d.ts +412 -487
  89. package/dist/view/node.d.ts +164 -163
  90. package/dist/view/observer/arrowkeysobserver.d.ts +37 -37
  91. package/dist/view/observer/bubblingemittermixin.d.ts +163 -153
  92. package/dist/view/observer/bubblingeventinfo.d.ts +45 -42
  93. package/dist/view/observer/clickobserver.d.ts +36 -36
  94. package/dist/view/observer/compositionobserver.d.ts +67 -67
  95. package/dist/view/observer/domeventdata.d.ts +46 -46
  96. package/dist/view/observer/domeventobserver.d.ts +77 -74
  97. package/dist/view/observer/fakeselectionobserver.d.ts +42 -42
  98. package/dist/view/observer/focusobserver.d.ts +84 -84
  99. package/dist/view/observer/inputobserver.d.ts +76 -76
  100. package/dist/view/observer/keyobserver.d.ts +53 -53
  101. package/dist/view/observer/mouseobserver.d.ts +73 -73
  102. package/dist/view/observer/mutationobserver.d.ts +101 -101
  103. package/dist/view/observer/observer.d.ts +84 -83
  104. package/dist/view/observer/pointerobserver.d.ts +63 -63
  105. package/dist/view/observer/selectionobserver.d.ts +136 -136
  106. package/dist/view/observer/tabobserver.d.ts +38 -38
  107. package/dist/view/observer/touchobserver.d.ts +60 -60
  108. package/dist/view/placeholder.d.ts +80 -80
  109. package/dist/view/position.d.ts +187 -187
  110. package/dist/view/range.d.ts +282 -282
  111. package/dist/view/rawelement.d.ts +72 -72
  112. package/dist/view/renderer.d.ts +270 -272
  113. package/dist/view/rooteditableelement.d.ts +43 -43
  114. package/dist/view/selection.d.ts +356 -369
  115. package/dist/view/styles/background.d.ts +15 -15
  116. package/dist/view/styles/border.d.ts +27 -27
  117. package/dist/view/styles/margin.d.ts +12 -12
  118. package/dist/view/styles/padding.d.ts +12 -12
  119. package/dist/view/styles/utils.d.ts +72 -72
  120. package/dist/view/stylesmap.d.ts +715 -715
  121. package/dist/view/text.d.ts +75 -75
  122. package/dist/view/textproxy.d.ts +92 -92
  123. package/dist/view/tokenlist.d.ts +104 -104
  124. package/dist/view/treewalker.d.ts +201 -201
  125. package/dist/view/typecheckable.d.ts +445 -445
  126. package/dist/view/uielement.d.ts +93 -93
  127. package/dist/view/upcastwriter.d.ts +412 -412
  128. package/dist/view/view.d.ts +466 -469
  129. package/package.json +2 -2
@@ -1,458 +1,463 @@
1
1
  /**
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
- */
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
- * @module engine/model/range
7
- */
8
- import { ModelTypeCheckable } from './typecheckable.js';
9
- import { ModelPosition } from './position.js';
10
- import { ModelTreeWalker, type ModelTreeWalkerOptions, type ModelTreeWalkerValue } from './treewalker.js';
11
- import { type ModelDocument } from './document.js';
12
- import { type ModelDocumentFragment } from './documentfragment.js';
13
- import { type ModelElement } from './element.js';
14
- import { type InsertOperation } from './operation/insertoperation.js';
15
- import { type ModelItem } from './item.js';
16
- import { type MergeOperation } from './operation/mergeoperation.js';
17
- import { type MoveOperation } from './operation/moveoperation.js';
18
- import { type Operation } from './operation/operation.js';
19
- import { type SplitOperation } from './operation/splitoperation.js';
6
+ * @module engine/model/range
7
+ */
8
+ import { ModelTypeCheckable } from "./typecheckable.js";
9
+ import { ModelPosition } from "./position.js";
10
+ import { ModelTreeWalker, type ModelTreeWalkerOptions, type ModelTreeWalkerValue } from "./treewalker.js";
11
+ import { type ModelDocument } from "./document.js";
12
+ import { type ModelDocumentFragment } from "./documentfragment.js";
13
+ import { type ModelElement } from "./element.js";
14
+ import { type InsertOperation } from "./operation/insertoperation.js";
15
+ import { type ModelItem } from "./item.js";
16
+ import { type MergeOperation } from "./operation/mergeoperation.js";
17
+ import { type MoveOperation } from "./operation/moveoperation.js";
18
+ import { type Operation } from "./operation/operation.js";
19
+ import { type SplitOperation } from "./operation/splitoperation.js";
20
20
  /**
21
- * Represents a range in the model tree.
22
- *
23
- * A range is defined by its {@link module:engine/model/range~ModelRange#start} and {@link module:engine/model/range~ModelRange#end}
24
- * positions.
25
- *
26
- * You can create range instances via its constructor or the `createRange*()` factory methods of
27
- * {@link module:engine/model/model~Model} and {@link module:engine/model/writer~ModelWriter}.
28
- */
21
+ * Represents a range in the model tree.
22
+ *
23
+ * A range is defined by its {@link module:engine/model/range~ModelRange#start} and {@link module:engine/model/range~ModelRange#end}
24
+ * positions.
25
+ *
26
+ * You can create range instances via its constructor or the `createRange*()` factory methods of
27
+ * {@link module:engine/model/model~Model} and {@link module:engine/model/writer~ModelWriter}.
28
+ */
29
29
  export declare class ModelRange extends ModelTypeCheckable implements Iterable<ModelTreeWalkerValue> {
30
- /**
31
- * Start position.
32
- */
33
- readonly start: ModelPosition;
34
- /**
35
- * End position.
36
- */
37
- readonly end: ModelPosition;
38
- /**
39
- * Creates a range spanning from `start` position to `end` position.
40
- *
41
- * @param start The start position.
42
- * @param end The end position. If not set, the range will be collapsed at the `start` position.
43
- */
44
- constructor(start: ModelPosition, end?: ModelPosition | null);
45
- /**
46
- * Iterable interface.
47
- *
48
- * Iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns
49
- * them together with additional information like length or {@link module:engine/model/position~ModelPosition positions},
50
- * grouped as {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
51
- * It iterates over all {@link module:engine/model/textproxy~ModelTextProxy text contents} that are inside the range
52
- * and all the {@link module:engine/model/element~ModelElement}s that are entered into when iterating over this range.
53
- *
54
- * This iterator uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range
55
- * and `ignoreElementEnd` option set to `true`.
56
- */
57
- [Symbol.iterator](): IterableIterator<ModelTreeWalkerValue>;
58
- /**
59
- * Describes whether the range is collapsed, that is if {@link #start} and
60
- * {@link #end} positions are equal.
61
- */
62
- get isCollapsed(): boolean;
63
- /**
64
- * Describes whether this range is flat, that is if {@link #start} position and
65
- * {@link #end} position are in the same {@link module:engine/model/position~ModelPosition#parent}.
66
- */
67
- get isFlat(): boolean;
68
- /**
69
- * Range root element.
70
- */
71
- get root(): ModelElement | ModelDocumentFragment;
72
- /**
73
- * Checks whether this range contains given {@link module:engine/model/position~ModelPosition position}.
74
- *
75
- * @param position Position to check.
76
- * @returns `true` if given {@link module:engine/model/position~ModelPosition position} is contained
77
- * in this range,`false` otherwise.
78
- */
79
- containsPosition(position: ModelPosition): boolean;
80
- /**
81
- * Checks whether this range contains given {@link ~ModelRange range}.
82
- *
83
- * @param otherRange Range to check.
84
- * @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot
85
- * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or
86
- * even be equal to this range. Note that collapsed ranges are always compared in strict mode.
87
- * @returns {Boolean} `true` if given {@link ~ModelRange range} boundaries are contained by this range, `false` otherwise.
88
- */
89
- containsRange(otherRange: ModelRange, loose?: boolean): boolean;
90
- /**
91
- * Checks whether given {@link module:engine/model/item~ModelItem} is inside this range.
92
- */
93
- containsItem(item: ModelItem): boolean;
94
- /**
95
- * Two ranges are equal if their {@link #start} and {@link #end} positions are equal.
96
- *
97
- * @param otherRange Range to compare with.
98
- * @returns `true` if ranges are equal, `false` otherwise.
99
- */
100
- isEqual(otherRange: ModelRange): boolean;
101
- /**
102
- * Checks and returns whether this range intersects with given range.
103
- *
104
- * @param otherRange Range to compare with.
105
- * @returns `true` if ranges intersect, `false` otherwise.
106
- */
107
- isIntersecting(otherRange: ModelRange): boolean;
108
- /**
109
- * Computes which part(s) of this {@link ~ModelRange range} is not a part of given {@link ~ModelRange range}.
110
- * Returned array contains zero, one or two {@link ~ModelRange ranges}.
111
- *
112
- * Examples:
113
- *
114
- * ```ts
115
- * let range = model.createRange(
116
- * model.createPositionFromPath( root, [ 2, 7 ] ),
117
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
118
- * );
119
- * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 5 ] ) );
120
- * let transformed = range.getDifference( otherRange );
121
- * // transformed array has no ranges because `otherRange` contains `range`
122
- *
123
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 3 ] ) );
124
- * transformed = range.getDifference( otherRange );
125
- * // transformed array has one range: from [ 3 ] to [ 4, 0, 1 ]
126
- *
127
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 4 ] ) );
128
- * transformed = range.getDifference( otherRange );
129
- * // transformed array has two ranges: from [ 2, 7 ] to [ 3 ] and from [ 4 ] to [ 4, 0, 1 ]
130
- * ```
131
- *
132
- * @param otherRange Range to differentiate against.
133
- * @returns The difference between ranges.
134
- */
135
- getDifference(otherRange: ModelRange): Array<ModelRange>;
136
- /**
137
- * Returns an intersection of this {@link ~ModelRange range} and given {@link ~ModelRange range}.
138
- * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.
139
- *
140
- * Examples:
141
- *
142
- * ```ts
143
- * let range = model.createRange(
144
- * model.createPositionFromPath( root, [ 2, 7 ] ),
145
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
146
- * );
147
- * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 2 ] ) );
148
- * let transformed = range.getIntersection( otherRange ); // null - ranges have no common part
149
- *
150
- * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 5 ] ) );
151
- * transformed = range.getIntersection( otherRange ); // range from [ 3 ] to [ 4, 0, 1 ]
152
- * ```
153
- *
154
- * @param otherRange Range to check for intersection.
155
- * @returns A common part of given ranges or `null` if ranges have no common part.
156
- */
157
- getIntersection(otherRange: ModelRange): ModelRange | null;
158
- /**
159
- * Returns a range created by joining this {@link ~ModelRange range} with the given {@link ~ModelRange range}.
160
- * If ranges have no common part, returns `null`.
161
- *
162
- * Examples:
163
- *
164
- * ```ts
165
- * let range = model.createRange(
166
- * model.createPositionFromPath( root, [ 2, 7 ] ),
167
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
168
- * );
169
- * let otherRange = model.createRange(
170
- * model.createPositionFromPath( root, [ 1 ] ),
171
- * model.createPositionFromPath( root, [ 2 ] )
172
- * );
173
- * let transformed = range.getJoined( otherRange ); // null - ranges have no common part
174
- *
175
- * otherRange = model.createRange(
176
- * model.createPositionFromPath( root, [ 3 ] ),
177
- * model.createPositionFromPath( root, [ 5 ] )
178
- * );
179
- * transformed = range.getJoined( otherRange ); // range from [ 2, 7 ] to [ 5 ]
180
- * ```
181
- *
182
- * @param otherRange Range to be joined.
183
- * @param loose Whether the intersection check is loose or strict. If the check is strict (`false`),
184
- * ranges are tested for intersection or whether start/end positions are equal. If the check is loose (`true`),
185
- * compared range is also checked if it's {@link module:engine/model/position~ModelPosition#isTouching touching} current range.
186
- * @returns A sum of given ranges or `null` if ranges have no common part.
187
- */
188
- getJoined(otherRange: ModelRange, loose?: boolean): ModelRange | null;
189
- /**
190
- * Computes and returns the smallest set of {@link #isFlat flat} ranges, that covers this range in whole.
191
- *
192
- * See an example of a model structure (`[` and `]` are range boundaries):
193
- *
194
- * ```
195
- * root root
196
- * |- element DIV DIV P2 P3 DIV
197
- * | |- element H H P1 f o o b a r H P4
198
- * | | |- "fir[st" fir[st lorem se]cond ipsum
199
- * | |- element P1
200
- * | | |- "lorem" ||
201
- * |- element P2 ||
202
- * | |- "foo" VV
203
- * |- element P3
204
- * | |- "bar" root
205
- * |- element DIV DIV [P2 P3] DIV
206
- * | |- element H H [P1] f o o b a r H P4
207
- * | | |- "se]cond" fir[st] lorem [se]cond ipsum
208
- * | |- element P4
209
- * | | |- "ipsum"
210
- * ```
211
- *
212
- * As it can be seen, letters contained in the range are: `stloremfoobarse`, spread across different parents.
213
- * We are looking for minimal set of flat ranges that contains the same nodes.
214
- *
215
- * Minimal flat ranges for above range `( [ 0, 0, 3 ], [ 3, 0, 2 ] )` will be:
216
- *
217
- * ```
218
- * ( [ 0, 0, 3 ], [ 0, 0, 5 ] ) = "st"
219
- * ( [ 0, 1 ], [ 0, 2 ] ) = element P1 ("lorem")
220
- * ( [ 1 ], [ 3 ] ) = element P2, element P3 ("foobar")
221
- * ( [ 3, 0, 0 ], [ 3, 0, 2 ] ) = "se"
222
- * ```
223
- *
224
- * **Note:** if an {@link module:engine/model/element~ModelElement element} is not wholly contained in this range, it won't be returned
225
- * in any of the returned flat ranges. See in the example how `H` elements at the beginning and at the end of the range
226
- * were omitted. Only their parts that were wholly in the range were returned.
227
- *
228
- * **Note:** this method is not returning flat ranges that contain no nodes.
229
- *
230
- * @returns Array of flat ranges covering this range.
231
- */
232
- getMinimalFlatRanges(): Array<ModelRange>;
233
- /**
234
- * Creates a {@link module:engine/model/treewalker~ModelTreeWalker TreeWalker} instance with this range as a boundary.
235
- *
236
- * For example, to iterate over all items in the entire document root:
237
- *
238
- * ```ts
239
- * // Create a range spanning over the entire root content:
240
- * const range = editor.model.createRangeIn( editor.model.document.getRoot() );
241
- *
242
- * // Iterate over all items in this range:
243
- * for ( const value of range.getWalker() ) {
244
- * console.log( value.item );
245
- * }
246
- * ```
247
- *
248
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
249
- */
250
- getWalker(options?: ModelTreeWalkerOptions): ModelTreeWalker;
251
- /**
252
- * Returns an iterator that iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns
253
- * them.
254
- *
255
- * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range and
256
- * `ignoreElementEnd` option set to `true`. However it returns only {@link module:engine/model/item~ModelItem model items},
257
- * not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
258
- *
259
- * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for
260
- * a full list of available options.
261
- *
262
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
263
- */
264
- getItems(options?: ModelTreeWalkerOptions): IterableIterator<ModelItem>;
265
- /**
266
- * Returns an iterator that iterates over all {@link module:engine/model/position~ModelPosition positions} that are boundaries or
267
- * contained in this range.
268
- *
269
- * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range. However it returns only
270
- * {@link module:engine/model/position~ModelPosition positions}, not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
271
- *
272
- * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for
273
- * a full list of available options.
274
- *
275
- * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
276
- */
277
- getPositions(options?: ModelTreeWalkerOptions): IterableIterator<ModelPosition>;
278
- /**
279
- * Returns a range that is a result of transforming this range by given `operation`.
280
- *
281
- * **Note:** transformation may break one range into multiple ranges (for example, when a part of the range is
282
- * moved to a different part of document tree). For this reason, an array is returned by this method and it
283
- * may contain one or more `Range` instances.
284
- *
285
- * @param operation Operation to transform range by.
286
- * @returns Range which is the result of transformation.
287
- */
288
- getTransformedByOperation(operation: Operation): Array<ModelRange>;
289
- /**
290
- * Returns a range that is a result of transforming this range by multiple `operations`.
291
- *
292
- * @see ~ModelRange#getTransformedByOperation
293
- * @param operations Operations to transform the range by.
294
- * @returns Range which is the result of transformation.
295
- */
296
- getTransformedByOperations(operations: Iterable<Operation>): Array<ModelRange>;
297
- /**
298
- * Returns an {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}
299
- * which is a common ancestor of the range's both ends (in which the entire range is contained).
300
- */
301
- getCommonAncestor(): ModelElement | ModelDocumentFragment | null;
302
- /**
303
- * Returns an {@link module:engine/model/element~ModelElement Element} contained by the range.
304
- * The element will be returned when it is the **only** node within the range and **fully–contained**
305
- * at the same time.
306
- */
307
- getContainedElement(): ModelElement | null;
308
- /**
309
- * Converts `Range` to plain object and returns it.
310
- *
311
- * @returns `Range` converted to plain object.
312
- */
313
- toJSON(): unknown;
314
- /**
315
- * Returns a new range that is equal to current range.
316
- */
317
- clone(): this;
318
- /**
319
- * Returns a result of transforming a copy of this range by insert operation.
320
- *
321
- * One or more ranges may be returned as a result of this transformation.
322
- *
323
- * @internal
324
- */
325
- _getTransformedByInsertOperation(operation: InsertOperation, spread?: boolean): Array<ModelRange>;
326
- /**
327
- * Returns a result of transforming a copy of this range by move operation.
328
- *
329
- * One or more ranges may be returned as a result of this transformation.
330
- *
331
- * @internal
332
- */
333
- _getTransformedByMoveOperation(operation: MoveOperation, spread?: boolean): Array<ModelRange>;
334
- /**
335
- * Returns a result of transforming a copy of this range by split operation.
336
- *
337
- * Always one range is returned. The transformation is done in a way to not break the range.
338
- *
339
- * @internal
340
- */
341
- _getTransformedBySplitOperation(operation: SplitOperation): ModelRange;
342
- /**
343
- * Returns a result of transforming a copy of this range by merge operation.
344
- *
345
- * Always one range is returned. The transformation is done in a way to not break the range.
346
- *
347
- * @internal
348
- */
349
- _getTransformedByMergeOperation(operation: MergeOperation): ModelRange;
350
- /**
351
- * Returns an array containing one or two {@link ~ModelRange ranges} that are a result of transforming this
352
- * {@link ~ModelRange range} by inserting `howMany` nodes at `insertPosition`. Two {@link ~ModelRange ranges} are
353
- * returned if the insertion was inside this {@link ~ModelRange range} and `spread` is set to `true`.
354
- *
355
- * Examples:
356
- *
357
- * ```ts
358
- * let range = model.createRange(
359
- * model.createPositionFromPath( root, [ 2, 7 ] ),
360
- * model.createPositionFromPath( root, [ 4, 0, 1 ] )
361
- * );
362
- * let transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 1 ] ), 2 );
363
- * // transformed array has one range from [ 4, 7 ] to [ 6, 0, 1 ]
364
- *
365
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 4, 0, 0 ] ), 4 );
366
- * // transformed array has one range from [ 2, 7 ] to [ 4, 0, 5 ]
367
- *
368
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4 );
369
- * // transformed array has one range, which is equal to original range
370
- *
371
- * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4, true );
372
- * // transformed array has two ranges: from [ 2, 7 ] to [ 3, 2 ] and from [ 3, 6 ] to [ 4, 0, 1 ]
373
- * ```
374
- *
375
- * @internal
376
- * @param insertPosition Position where nodes are inserted.
377
- * @param howMany How many nodes are inserted.
378
- * @param spread Flag indicating whether this range should be spread if insertion
379
- * was inside the range. Defaults to `false`.
380
- * @returns Result of the transformation.
381
- */
382
- _getTransformedByInsertion(insertPosition: ModelPosition, howMany: number, spread?: boolean): Array<ModelRange>;
383
- /**
384
- * Returns an array containing {@link ~ModelRange ranges} that are a result of transforming this
385
- * {@link ~ModelRange range} by moving `howMany` nodes from `sourcePosition` to `targetPosition`.
386
- *
387
- * @internal
388
- * @param sourcePosition Position from which nodes are moved.
389
- * @param targetPosition Position to where nodes are moved.
390
- * @param howMany How many nodes are moved.
391
- * @param spread Whether the range should be spread if the move points inside the range.
392
- * @returns Result of the transformation.
393
- */
394
- _getTransformedByMove(sourcePosition: ModelPosition, targetPosition: ModelPosition, howMany: number, spread?: boolean): Array<ModelRange>;
395
- /**
396
- * Returns a copy of this range that is transformed by deletion of `howMany` nodes from `deletePosition`.
397
- *
398
- * If the deleted range is intersecting with the transformed range, the transformed range will be shrank.
399
- *
400
- * If the deleted range contains transformed range, `null` will be returned.
401
- *
402
- * @internal
403
- * @param deletePosition Position from which nodes are removed.
404
- * @param howMany How many nodes are removed.
405
- * @returns Result of the transformation.
406
- */
407
- _getTransformedByDeletion(deletePosition: ModelPosition, howMany: number): ModelRange | null;
408
- /**
409
- * Creates a new range, spreading from specified {@link module:engine/model/position~ModelPosition position} to a position moved by
410
- * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.
411
- *
412
- * @internal
413
- * @param position Beginning of the range.
414
- * @param shift How long the range should be.
415
- */
416
- static _createFromPositionAndShift(position: ModelPosition, shift: number): ModelRange;
417
- /**
418
- * Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the first child of
419
- * that element and ends after the last child of that element.
420
- *
421
- * @internal
422
- * @param element Element which is a parent for the range.
423
- */
424
- static _createIn(element: ModelElement | ModelDocumentFragment): ModelRange;
425
- /**
426
- * Creates a range that starts before given {@link module:engine/model/item~ModelItem model item} and ends after it.
427
- *
428
- * @internal
429
- */
430
- static _createOn(item: ModelItem): ModelRange;
431
- /**
432
- * Combines all ranges from the passed array into a one range. At least one range has to be passed.
433
- * Passed ranges must not have common parts.
434
- *
435
- * The first range from the array is a reference range. If other ranges start or end on the exactly same position where
436
- * the reference range, they get combined into one range.
437
- *
438
- * ```
439
- * [ ][] [ ][ ][ ][ ][] [ ] // Passed ranges, shown sorted
440
- * [ ] // The result of the function if the first range was a reference range.
441
- * [ ] // The result of the function if the third-to-seventh range was a reference range.
442
- * [ ] // The result of the function if the last range was a reference range.
443
- * ```
444
- *
445
- * @internal
446
- * @param ranges Ranges to combine.
447
- * @returns Combined range.
448
- */
449
- static _createFromRanges(ranges: Array<ModelRange>): ModelRange;
450
- /**
451
- * Creates a `Range` instance from given plain object (i.e. parsed JSON string).
452
- *
453
- * @param json Plain object to be converted to `Range`.
454
- * @param doc Document object that will be range owner.
455
- * @returns `Range` instance created using given plain object.
456
- */
457
- static fromJSON(json: any, doc: ModelDocument): ModelRange;
30
+ /**
31
+ * Start position.
32
+ */
33
+ readonly start: ModelPosition;
34
+ /**
35
+ * End position.
36
+ */
37
+ readonly end: ModelPosition;
38
+ /**
39
+ * Creates a range spanning from `start` position to `end` position.
40
+ *
41
+ * @param start The start position.
42
+ * @param end The end position. If not set, the range will be collapsed at the `start` position.
43
+ */
44
+ constructor(start: ModelPosition, end?: ModelPosition | null);
45
+ /**
46
+ * Iterable interface.
47
+ *
48
+ * Iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns
49
+ * them together with additional information like length or {@link module:engine/model/position~ModelPosition positions},
50
+ * grouped as {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
51
+ * It iterates over all {@link module:engine/model/textproxy~ModelTextProxy text contents} that are inside the range
52
+ * and all the {@link module:engine/model/element~ModelElement}s that are entered into when iterating over this range.
53
+ *
54
+ * This iterator uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range
55
+ * and `ignoreElementEnd` option set to `true`.
56
+ */
57
+ [Symbol.iterator](): IterableIterator<ModelTreeWalkerValue>;
58
+ /**
59
+ * Describes whether the range is collapsed, that is if {@link #start} and
60
+ * {@link #end} positions are equal.
61
+ */
62
+ get isCollapsed(): boolean;
63
+ /**
64
+ * Describes whether this range is flat, that is if {@link #start} position and
65
+ * {@link #end} position are in the same {@link module:engine/model/position~ModelPosition#parent}.
66
+ */
67
+ get isFlat(): boolean;
68
+ /**
69
+ * Range root element.
70
+ */
71
+ get root(): ModelElement | ModelDocumentFragment;
72
+ /**
73
+ * Checks whether this range contains given {@link module:engine/model/position~ModelPosition position}.
74
+ *
75
+ * @param position Position to check.
76
+ * @returns `true` if given {@link module:engine/model/position~ModelPosition position} is contained
77
+ * in this range,`false` otherwise.
78
+ */
79
+ containsPosition(position: ModelPosition): boolean;
80
+ /**
81
+ * Checks whether this range contains given {@link module:engine/model/range~ModelRange range}.
82
+ *
83
+ * @param otherRange Range to check.
84
+ * @param loose Whether the check is loose or strict. If the check is strict (`false`), compared range cannot
85
+ * start or end at the same position as this range boundaries. If the check is loose (`true`), compared range can start, end or
86
+ * even be equal to this range. Note that collapsed ranges are always compared in strict mode.
87
+ * @returns {Boolean} `true` if given {@link module:engine/model/range~ModelRange range} boundaries are contained by this range,
88
+ * `false` otherwise.
89
+ */
90
+ containsRange(otherRange: ModelRange, loose?: boolean): boolean;
91
+ /**
92
+ * Checks whether given {@link module:engine/model/item~ModelItem} is inside this range.
93
+ */
94
+ containsItem(item: ModelItem): boolean;
95
+ /**
96
+ * Two ranges are equal if their {@link #start} and {@link #end} positions are equal.
97
+ *
98
+ * @param otherRange Range to compare with.
99
+ * @returns `true` if ranges are equal, `false` otherwise.
100
+ */
101
+ isEqual(otherRange: ModelRange): boolean;
102
+ /**
103
+ * Checks and returns whether this range intersects with given range.
104
+ *
105
+ * @param otherRange Range to compare with.
106
+ * @returns `true` if ranges intersect, `false` otherwise.
107
+ */
108
+ isIntersecting(otherRange: ModelRange): boolean;
109
+ /**
110
+ * Computes which part(s) of this {@link module:engine/model/range~ModelRange range} is not a part of given
111
+ * {@link module:engine/model/range~ModelRange range}.
112
+ * Returned array contains zero, one or two {@link module:engine/model/range~ModelRange ranges}.
113
+ *
114
+ * Examples:
115
+ *
116
+ * ```ts
117
+ * let range = model.createRange(
118
+ * model.createPositionFromPath( root, [ 2, 7 ] ),
119
+ * model.createPositionFromPath( root, [ 4, 0, 1 ] )
120
+ * );
121
+ * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 5 ] ) );
122
+ * let transformed = range.getDifference( otherRange );
123
+ * // transformed array has no ranges because `otherRange` contains `range`
124
+ *
125
+ * otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 3 ] ) );
126
+ * transformed = range.getDifference( otherRange );
127
+ * // transformed array has one range: from [ 3 ] to [ 4, 0, 1 ]
128
+ *
129
+ * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 4 ] ) );
130
+ * transformed = range.getDifference( otherRange );
131
+ * // transformed array has two ranges: from [ 2, 7 ] to [ 3 ] and from [ 4 ] to [ 4, 0, 1 ]
132
+ * ```
133
+ *
134
+ * @param otherRange Range to differentiate against.
135
+ * @returns The difference between ranges.
136
+ */
137
+ getDifference(otherRange: ModelRange): Array<ModelRange>;
138
+ /**
139
+ * Returns an intersection of this {@link module:engine/model/range~ModelRange range} and given
140
+ * {@link module:engine/model/range~ModelRange range}.
141
+ * Intersection is a common part of both of those ranges. If ranges has no common part, returns `null`.
142
+ *
143
+ * Examples:
144
+ *
145
+ * ```ts
146
+ * let range = model.createRange(
147
+ * model.createPositionFromPath( root, [ 2, 7 ] ),
148
+ * model.createPositionFromPath( root, [ 4, 0, 1 ] )
149
+ * );
150
+ * let otherRange = model.createRange( model.createPositionFromPath( root, [ 1 ] ), model.createPositionFromPath( root, [ 2 ] ) );
151
+ * let transformed = range.getIntersection( otherRange ); // null - ranges have no common part
152
+ *
153
+ * otherRange = model.createRange( model.createPositionFromPath( root, [ 3 ] ), model.createPositionFromPath( root, [ 5 ] ) );
154
+ * transformed = range.getIntersection( otherRange ); // range from [ 3 ] to [ 4, 0, 1 ]
155
+ * ```
156
+ *
157
+ * @param otherRange Range to check for intersection.
158
+ * @returns A common part of given ranges or `null` if ranges have no common part.
159
+ */
160
+ getIntersection(otherRange: ModelRange): ModelRange | null;
161
+ /**
162
+ * Returns a range created by joining this {@link module:engine/model/range~ModelRange range} with the given
163
+ * {@link module:engine/model/range~ModelRange range}.
164
+ * If ranges have no common part, returns `null`.
165
+ *
166
+ * Examples:
167
+ *
168
+ * ```ts
169
+ * let range = model.createRange(
170
+ * model.createPositionFromPath( root, [ 2, 7 ] ),
171
+ * model.createPositionFromPath( root, [ 4, 0, 1 ] )
172
+ * );
173
+ * let otherRange = model.createRange(
174
+ * model.createPositionFromPath( root, [ 1 ] ),
175
+ * model.createPositionFromPath( root, [ 2 ] )
176
+ * );
177
+ * let transformed = range.getJoined( otherRange ); // null - ranges have no common part
178
+ *
179
+ * otherRange = model.createRange(
180
+ * model.createPositionFromPath( root, [ 3 ] ),
181
+ * model.createPositionFromPath( root, [ 5 ] )
182
+ * );
183
+ * transformed = range.getJoined( otherRange ); // range from [ 2, 7 ] to [ 5 ]
184
+ * ```
185
+ *
186
+ * @param otherRange Range to be joined.
187
+ * @param loose Whether the intersection check is loose or strict. If the check is strict (`false`),
188
+ * ranges are tested for intersection or whether start/end positions are equal. If the check is loose (`true`),
189
+ * compared range is also checked if it's {@link module:engine/model/position~ModelPosition#isTouching touching} current range.
190
+ * @returns A sum of given ranges or `null` if ranges have no common part.
191
+ */
192
+ getJoined(otherRange: ModelRange, loose?: boolean): ModelRange | null;
193
+ /**
194
+ * Computes and returns the smallest set of {@link #isFlat flat} ranges, that covers this range in whole.
195
+ *
196
+ * See an example of a model structure (`[` and `]` are range boundaries):
197
+ *
198
+ * ```
199
+ * root root
200
+ * |- element DIV DIV P2 P3 DIV
201
+ * | |- element H H P1 f o o b a r H P4
202
+ * | | |- "fir[st" fir[st lorem se]cond ipsum
203
+ * | |- element P1
204
+ * | | |- "lorem" ||
205
+ * |- element P2 ||
206
+ * | |- "foo" VV
207
+ * |- element P3
208
+ * | |- "bar" root
209
+ * |- element DIV DIV [P2 P3] DIV
210
+ * | |- element H H [P1] f o o b a r H P4
211
+ * | | |- "se]cond" fir[st] lorem [se]cond ipsum
212
+ * | |- element P4
213
+ * | | |- "ipsum"
214
+ * ```
215
+ *
216
+ * As it can be seen, letters contained in the range are: `stloremfoobarse`, spread across different parents.
217
+ * We are looking for minimal set of flat ranges that contains the same nodes.
218
+ *
219
+ * Minimal flat ranges for above range `( [ 0, 0, 3 ], [ 3, 0, 2 ] )` will be:
220
+ *
221
+ * ```
222
+ * ( [ 0, 0, 3 ], [ 0, 0, 5 ] ) = "st"
223
+ * ( [ 0, 1 ], [ 0, 2 ] ) = element P1 ("lorem")
224
+ * ( [ 1 ], [ 3 ] ) = element P2, element P3 ("foobar")
225
+ * ( [ 3, 0, 0 ], [ 3, 0, 2 ] ) = "se"
226
+ * ```
227
+ *
228
+ * **Note:** if an {@link module:engine/model/element~ModelElement element} is not wholly contained in this range, it won't be returned
229
+ * in any of the returned flat ranges. See in the example how `H` elements at the beginning and at the end of the range
230
+ * were omitted. Only their parts that were wholly in the range were returned.
231
+ *
232
+ * **Note:** this method is not returning flat ranges that contain no nodes.
233
+ *
234
+ * @returns Array of flat ranges covering this range.
235
+ */
236
+ getMinimalFlatRanges(): Array<ModelRange>;
237
+ /**
238
+ * Creates a {@link module:engine/model/treewalker~ModelTreeWalker TreeWalker} instance with this range as a boundary.
239
+ *
240
+ * For example, to iterate over all items in the entire document root:
241
+ *
242
+ * ```ts
243
+ * // Create a range spanning over the entire root content:
244
+ * const range = editor.model.createRangeIn( editor.model.document.getRoot() );
245
+ *
246
+ * // Iterate over all items in this range:
247
+ * for ( const value of range.getWalker() ) {
248
+ * console.log( value.item );
249
+ * }
250
+ * ```
251
+ *
252
+ * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
253
+ */
254
+ getWalker(options?: ModelTreeWalkerOptions): ModelTreeWalker;
255
+ /**
256
+ * Returns an iterator that iterates over all {@link module:engine/model/item~ModelItem items} that are in this range and returns
257
+ * them.
258
+ *
259
+ * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range and
260
+ * `ignoreElementEnd` option set to `true`. However it returns only {@link module:engine/model/item~ModelItem model items},
261
+ * not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
262
+ *
263
+ * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for
264
+ * a full list of available options.
265
+ *
266
+ * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
267
+ */
268
+ getItems(options?: ModelTreeWalkerOptions): IterableIterator<ModelItem>;
269
+ /**
270
+ * Returns an iterator that iterates over all {@link module:engine/model/position~ModelPosition positions} that are boundaries or
271
+ * contained in this range.
272
+ *
273
+ * This method uses {@link module:engine/model/treewalker~ModelTreeWalker} with `boundaries` set to this range. However it returns only
274
+ * {@link module:engine/model/position~ModelPosition positions}, not {@link module:engine/model/treewalker~ModelTreeWalkerValue}.
275
+ *
276
+ * You may specify additional options for the tree walker. See {@link module:engine/model/treewalker~ModelTreeWalker} for
277
+ * a full list of available options.
278
+ *
279
+ * @param options Object with configuration options. See {@link module:engine/model/treewalker~ModelTreeWalker}.
280
+ */
281
+ getPositions(options?: ModelTreeWalkerOptions): IterableIterator<ModelPosition>;
282
+ /**
283
+ * Returns a range that is a result of transforming this range by given `operation`.
284
+ *
285
+ * **Note:** transformation may break one range into multiple ranges (for example, when a part of the range is
286
+ * moved to a different part of document tree). For this reason, an array is returned by this method and it
287
+ * may contain one or more `Range` instances.
288
+ *
289
+ * @param operation Operation to transform range by.
290
+ * @returns Range which is the result of transformation.
291
+ */
292
+ getTransformedByOperation(operation: Operation): Array<ModelRange>;
293
+ /**
294
+ * Returns a range that is a result of transforming this range by multiple `operations`.
295
+ *
296
+ * @see module:engine/model/range~ModelRange#getTransformedByOperation
297
+ * @param operations Operations to transform the range by.
298
+ * @returns Range which is the result of transformation.
299
+ */
300
+ getTransformedByOperations(operations: Iterable<Operation>): Array<ModelRange>;
301
+ /**
302
+ * Returns an {@link module:engine/model/element~ModelElement} or {@link module:engine/model/documentfragment~ModelDocumentFragment}
303
+ * which is a common ancestor of the range's both ends (in which the entire range is contained).
304
+ */
305
+ getCommonAncestor(): ModelElement | ModelDocumentFragment | null;
306
+ /**
307
+ * Returns an {@link module:engine/model/element~ModelElement Element} contained by the range.
308
+ * The element will be returned when it is the **only** node within the range and **fully–contained**
309
+ * at the same time.
310
+ */
311
+ getContainedElement(): ModelElement | null;
312
+ /**
313
+ * Converts `Range` to plain object and returns it.
314
+ *
315
+ * @returns `Range` converted to plain object.
316
+ */
317
+ toJSON(): unknown;
318
+ /**
319
+ * Returns a new range that is equal to current range.
320
+ */
321
+ clone(): this;
322
+ /**
323
+ * Returns a result of transforming a copy of this range by insert operation.
324
+ *
325
+ * One or more ranges may be returned as a result of this transformation.
326
+ *
327
+ * @internal
328
+ */
329
+ _getTransformedByInsertOperation(operation: InsertOperation, spread?: boolean): Array<ModelRange>;
330
+ /**
331
+ * Returns a result of transforming a copy of this range by move operation.
332
+ *
333
+ * One or more ranges may be returned as a result of this transformation.
334
+ *
335
+ * @internal
336
+ */
337
+ _getTransformedByMoveOperation(operation: MoveOperation, spread?: boolean): Array<ModelRange>;
338
+ /**
339
+ * Returns a result of transforming a copy of this range by split operation.
340
+ *
341
+ * Always one range is returned. The transformation is done in a way to not break the range.
342
+ *
343
+ * @internal
344
+ */
345
+ _getTransformedBySplitOperation(operation: SplitOperation): ModelRange;
346
+ /**
347
+ * Returns a result of transforming a copy of this range by merge operation.
348
+ *
349
+ * Always one range is returned. The transformation is done in a way to not break the range.
350
+ *
351
+ * @internal
352
+ */
353
+ _getTransformedByMergeOperation(operation: MergeOperation): ModelRange;
354
+ /**
355
+ * Returns an array containing one or two {@link module:engine/model/range~ModelRange ranges} that are a result of transforming this
356
+ * {@link module:engine/model/range~ModelRange range} by inserting `howMany` nodes at `insertPosition`. Two
357
+ * {@link module:engine/model/range~ModelRange ranges} are returned if the insertion was inside this
358
+ * {@link module:engine/model/range~ModelRange range} and `spread` is set to `true`.
359
+ *
360
+ * Examples:
361
+ *
362
+ * ```ts
363
+ * let range = model.createRange(
364
+ * model.createPositionFromPath( root, [ 2, 7 ] ),
365
+ * model.createPositionFromPath( root, [ 4, 0, 1 ] )
366
+ * );
367
+ * let transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 1 ] ), 2 );
368
+ * // transformed array has one range from [ 4, 7 ] to [ 6, 0, 1 ]
369
+ *
370
+ * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 4, 0, 0 ] ), 4 );
371
+ * // transformed array has one range from [ 2, 7 ] to [ 4, 0, 5 ]
372
+ *
373
+ * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4 );
374
+ * // transformed array has one range, which is equal to original range
375
+ *
376
+ * transformed = range._getTransformedByInsertion( model.createPositionFromPath( root, [ 3, 2 ] ), 4, true );
377
+ * // transformed array has two ranges: from [ 2, 7 ] to [ 3, 2 ] and from [ 3, 6 ] to [ 4, 0, 1 ]
378
+ * ```
379
+ *
380
+ * @internal
381
+ * @param insertPosition Position where nodes are inserted.
382
+ * @param howMany How many nodes are inserted.
383
+ * @param spread Flag indicating whether this range should be spread if insertion
384
+ * was inside the range. Defaults to `false`.
385
+ * @returns Result of the transformation.
386
+ */
387
+ _getTransformedByInsertion(insertPosition: ModelPosition, howMany: number, spread?: boolean): Array<ModelRange>;
388
+ /**
389
+ * Returns an array containing {@link module:engine/model/range~ModelRange ranges} that are a result of transforming this
390
+ * {@link module:engine/model/range~ModelRange range} by moving `howMany` nodes from `sourcePosition` to `targetPosition`.
391
+ *
392
+ * @internal
393
+ * @param sourcePosition Position from which nodes are moved.
394
+ * @param targetPosition Position to where nodes are moved.
395
+ * @param howMany How many nodes are moved.
396
+ * @param spread Whether the range should be spread if the move points inside the range.
397
+ * @returns Result of the transformation.
398
+ */
399
+ _getTransformedByMove(sourcePosition: ModelPosition, targetPosition: ModelPosition, howMany: number, spread?: boolean): Array<ModelRange>;
400
+ /**
401
+ * Returns a copy of this range that is transformed by deletion of `howMany` nodes from `deletePosition`.
402
+ *
403
+ * If the deleted range is intersecting with the transformed range, the transformed range will be shrank.
404
+ *
405
+ * If the deleted range contains transformed range, `null` will be returned.
406
+ *
407
+ * @internal
408
+ * @param deletePosition Position from which nodes are removed.
409
+ * @param howMany How many nodes are removed.
410
+ * @returns Result of the transformation.
411
+ */
412
+ _getTransformedByDeletion(deletePosition: ModelPosition, howMany: number): ModelRange | null;
413
+ /**
414
+ * Creates a new range, spreading from specified {@link module:engine/model/position~ModelPosition position} to a position moved by
415
+ * given `shift`. If `shift` is a negative value, shifted position is treated as the beginning of the range.
416
+ *
417
+ * @internal
418
+ * @param position Beginning of the range.
419
+ * @param shift How long the range should be.
420
+ */
421
+ static _createFromPositionAndShift(position: ModelPosition, shift: number): ModelRange;
422
+ /**
423
+ * Creates a range inside an {@link module:engine/model/element~ModelElement element} which starts before the first child of
424
+ * that element and ends after the last child of that element.
425
+ *
426
+ * @internal
427
+ * @param element Element which is a parent for the range.
428
+ */
429
+ static _createIn(element: ModelElement | ModelDocumentFragment): ModelRange;
430
+ /**
431
+ * Creates a range that starts before given {@link module:engine/model/item~ModelItem model item} and ends after it.
432
+ *
433
+ * @internal
434
+ */
435
+ static _createOn(item: ModelItem): ModelRange;
436
+ /**
437
+ * Combines all ranges from the passed array into a one range. At least one range has to be passed.
438
+ * Passed ranges must not have common parts.
439
+ *
440
+ * The first range from the array is a reference range. If other ranges start or end on the exactly same position where
441
+ * the reference range, they get combined into one range.
442
+ *
443
+ * ```
444
+ * [ ][] [ ][ ][ ][ ][] [ ] // Passed ranges, shown sorted
445
+ * [ ] // The result of the function if the first range was a reference range.
446
+ * [ ] // The result of the function if the third-to-seventh range was a reference range.
447
+ * [ ] // The result of the function if the last range was a reference range.
448
+ * ```
449
+ *
450
+ * @internal
451
+ * @param ranges Ranges to combine.
452
+ * @returns Combined range.
453
+ */
454
+ static _createFromRanges(ranges: Array<ModelRange>): ModelRange;
455
+ /**
456
+ * Creates a `Range` instance from given plain object (i.e. parsed JSON string).
457
+ *
458
+ * @param json Plain object to be converted to `Range`.
459
+ * @param doc Document object that will be range owner.
460
+ * @returns `Range` instance created using given plain object.
461
+ */
462
+ static fromJSON(json: any, doc: ModelDocument): ModelRange;
458
463
  }