@ckeditor/ckeditor5-engine 45.2.1 → 46.0.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 (241) hide show
  1. package/dist/index.js +2563 -2257
  2. package/dist/index.js.map +1 -1
  3. package/package.json +3 -3
  4. package/src/controller/datacontroller.d.ts +33 -32
  5. package/src/controller/datacontroller.js +29 -28
  6. package/src/controller/editingcontroller.d.ts +8 -8
  7. package/src/controller/editingcontroller.js +10 -10
  8. package/src/conversion/conversion.d.ts +18 -19
  9. package/src/conversion/conversion.js +4 -4
  10. package/src/conversion/conversionhelpers.d.ts +1 -1
  11. package/src/conversion/conversionhelpers.js +1 -1
  12. package/src/conversion/downcastdispatcher.d.ts +63 -69
  13. package/src/conversion/downcastdispatcher.js +16 -16
  14. package/src/conversion/downcasthelpers.d.ts +94 -83
  15. package/src/conversion/downcasthelpers.js +63 -53
  16. package/src/conversion/mapper.d.ts +27 -27
  17. package/src/conversion/mapper.js +15 -15
  18. package/src/conversion/modelconsumable.d.ts +26 -26
  19. package/src/conversion/modelconsumable.js +23 -23
  20. package/src/conversion/upcastdispatcher.d.ts +33 -32
  21. package/src/conversion/upcastdispatcher.js +19 -19
  22. package/src/conversion/upcasthelpers.d.ts +46 -38
  23. package/src/conversion/upcasthelpers.js +33 -24
  24. package/src/conversion/viewconsumable.d.ts +50 -45
  25. package/src/conversion/viewconsumable.js +32 -27
  26. package/src/dataprocessor/basichtmlwriter.d.ts +4 -2
  27. package/src/dataprocessor/basichtmlwriter.js +3 -1
  28. package/src/dataprocessor/dataprocessor.d.ts +7 -6
  29. package/src/dataprocessor/htmldataprocessor.d.ts +10 -10
  30. package/src/dataprocessor/htmldataprocessor.js +6 -6
  31. package/src/dataprocessor/htmlwriter.d.ts +1 -1
  32. package/src/dataprocessor/xmldataprocessor.d.ts +10 -10
  33. package/src/dataprocessor/xmldataprocessor.js +6 -6
  34. package/src/dev-utils/model.d.ts +25 -26
  35. package/src/dev-utils/model.js +35 -36
  36. package/src/dev-utils/operationreplayer.d.ts +5 -3
  37. package/src/dev-utils/operationreplayer.js +4 -2
  38. package/src/dev-utils/utils.d.ts +8 -0
  39. package/src/dev-utils/utils.js +8 -0
  40. package/src/dev-utils/view.d.ts +66 -63
  41. package/src/dev-utils/view.js +144 -134
  42. package/src/index.d.ts +135 -106
  43. package/src/index.js +120 -71
  44. package/src/legacyerrors.d.ts +5 -0
  45. package/src/legacyerrors.js +17 -0
  46. package/src/model/batch.d.ts +2 -15
  47. package/src/model/batch.js +1 -23
  48. package/src/model/differ.d.ts +54 -31
  49. package/src/model/differ.js +15 -15
  50. package/src/model/document.d.ts +31 -31
  51. package/src/model/document.js +13 -13
  52. package/src/model/documentfragment.d.ts +45 -45
  53. package/src/model/documentfragment.js +40 -40
  54. package/src/model/documentselection.d.ts +92 -92
  55. package/src/model/documentselection.js +71 -70
  56. package/src/model/element.d.ts +31 -31
  57. package/src/model/element.js +29 -29
  58. package/src/model/history.d.ts +3 -3
  59. package/src/model/history.js +2 -2
  60. package/src/model/item.d.ts +4 -5
  61. package/src/model/liveposition.d.ts +31 -31
  62. package/src/model/liveposition.js +18 -18
  63. package/src/model/liverange.d.ts +42 -38
  64. package/src/model/liverange.js +17 -16
  65. package/src/model/markercollection.d.ts +41 -40
  66. package/src/model/markercollection.js +22 -20
  67. package/src/model/model.d.ts +82 -81
  68. package/src/model/model.js +54 -54
  69. package/src/model/node.d.ts +48 -48
  70. package/src/model/node.js +31 -31
  71. package/src/model/nodelist.d.ts +17 -17
  72. package/src/model/nodelist.js +11 -11
  73. package/src/model/operation/attributeoperation.d.ts +10 -10
  74. package/src/model/operation/attributeoperation.js +7 -7
  75. package/src/model/operation/detachoperation.d.ts +11 -9
  76. package/src/model/operation/detachoperation.js +8 -6
  77. package/src/model/operation/insertoperation.d.ts +13 -13
  78. package/src/model/operation/insertoperation.js +15 -15
  79. package/src/model/operation/markeroperation.d.ts +12 -12
  80. package/src/model/operation/markeroperation.js +5 -5
  81. package/src/model/operation/mergeoperation.d.ts +16 -16
  82. package/src/model/operation/mergeoperation.js +18 -18
  83. package/src/model/operation/moveoperation.d.ts +16 -16
  84. package/src/model/operation/moveoperation.js +18 -15
  85. package/src/model/operation/nooperation.d.ts +4 -4
  86. package/src/model/operation/nooperation.js +2 -2
  87. package/src/model/operation/operation.d.ts +10 -10
  88. package/src/model/operation/operation.js +5 -5
  89. package/src/model/operation/operationfactory.d.ts +4 -4
  90. package/src/model/operation/operationfactory.js +12 -12
  91. package/src/model/operation/renameoperation.d.ts +10 -10
  92. package/src/model/operation/renameoperation.js +7 -7
  93. package/src/model/operation/rootattributeoperation.d.ts +12 -12
  94. package/src/model/operation/rootattributeoperation.js +8 -8
  95. package/src/model/operation/rootoperation.d.ts +8 -8
  96. package/src/model/operation/rootoperation.js +3 -3
  97. package/src/model/operation/splitoperation.d.ts +17 -17
  98. package/src/model/operation/splitoperation.js +19 -19
  99. package/src/model/operation/transform.d.ts +11 -8
  100. package/src/model/operation/transform.js +66 -49
  101. package/src/model/operation/utils.d.ts +24 -23
  102. package/src/model/operation/utils.js +20 -20
  103. package/src/model/position.d.ts +101 -97
  104. package/src/model/position.js +69 -64
  105. package/src/model/range.d.ts +90 -90
  106. package/src/model/range.js +87 -87
  107. package/src/model/rootelement.d.ts +11 -11
  108. package/src/model/rootelement.js +9 -9
  109. package/src/model/schema.d.ts +158 -154
  110. package/src/model/schema.js +93 -90
  111. package/src/model/selection.d.ts +73 -73
  112. package/src/model/selection.js +62 -62
  113. package/src/model/text.d.ts +11 -10
  114. package/src/model/text.js +11 -10
  115. package/src/model/textproxy.d.ts +39 -38
  116. package/src/model/textproxy.js +31 -30
  117. package/src/model/treewalker.d.ts +37 -37
  118. package/src/model/treewalker.js +14 -14
  119. package/src/model/typecheckable.d.ts +45 -45
  120. package/src/model/typecheckable.js +1 -1
  121. package/src/model/utils/autoparagraphing.d.ts +7 -7
  122. package/src/model/utils/deletecontent.d.ts +7 -5
  123. package/src/model/utils/deletecontent.js +13 -11
  124. package/src/model/utils/getselectedcontent.d.ts +6 -5
  125. package/src/model/utils/getselectedcontent.js +2 -1
  126. package/src/model/utils/insertcontent.d.ts +9 -8
  127. package/src/model/utils/insertcontent.js +41 -40
  128. package/src/model/utils/insertobject.d.ts +9 -9
  129. package/src/model/utils/insertobject.js +4 -4
  130. package/src/model/utils/modifyselection.d.ts +5 -4
  131. package/src/model/utils/modifyselection.js +12 -11
  132. package/src/model/utils/selection-post-fixer.d.ts +12 -8
  133. package/src/model/utils/selection-post-fixer.js +15 -11
  134. package/src/model/writer.d.ts +102 -101
  135. package/src/model/writer.js +99 -98
  136. package/src/view/attributeelement.d.ts +29 -29
  137. package/src/view/attributeelement.js +25 -25
  138. package/src/view/containerelement.d.ts +16 -15
  139. package/src/view/containerelement.js +15 -14
  140. package/src/view/datatransfer.d.ts +7 -7
  141. package/src/view/datatransfer.js +1 -1
  142. package/src/view/document.d.ts +25 -25
  143. package/src/view/document.js +15 -15
  144. package/src/view/documentfragment.d.ts +21 -21
  145. package/src/view/documentfragment.js +14 -14
  146. package/src/view/documentselection.d.ts +65 -63
  147. package/src/view/documentselection.js +27 -25
  148. package/src/view/domconverter.d.ts +96 -91
  149. package/src/view/domconverter.js +78 -73
  150. package/src/view/downcastwriter.d.ts +185 -181
  151. package/src/view/downcastwriter.js +222 -210
  152. package/src/view/editableelement.d.ts +13 -13
  153. package/src/view/editableelement.js +8 -8
  154. package/src/view/element.d.ts +75 -74
  155. package/src/view/element.js +58 -58
  156. package/src/view/elementdefinition.d.ts +3 -4
  157. package/src/view/emptyelement.d.ts +13 -13
  158. package/src/view/emptyelement.js +13 -13
  159. package/src/view/filler.d.ts +14 -3
  160. package/src/view/filler.js +12 -1
  161. package/src/view/item.d.ts +4 -5
  162. package/src/view/matcher.d.ts +22 -19
  163. package/src/view/matcher.js +6 -6
  164. package/src/view/node.d.ts +33 -33
  165. package/src/view/node.js +9 -9
  166. package/src/view/observer/arrowkeysobserver.d.ts +10 -10
  167. package/src/view/observer/arrowkeysobserver.js +5 -5
  168. package/src/view/observer/bubblingemittermixin.d.ts +5 -5
  169. package/src/view/observer/bubblingemittermixin.js +2 -9
  170. package/src/view/observer/bubblingeventinfo.d.ts +9 -9
  171. package/src/view/observer/bubblingeventinfo.js +1 -1
  172. package/src/view/observer/clickobserver.d.ts +8 -8
  173. package/src/view/observer/clickobserver.js +4 -4
  174. package/src/view/observer/compositionobserver.d.ts +19 -19
  175. package/src/view/observer/compositionobserver.js +6 -6
  176. package/src/view/observer/domeventdata.d.ts +9 -9
  177. package/src/view/observer/domeventdata.js +2 -2
  178. package/src/view/observer/domeventobserver.d.ts +3 -3
  179. package/src/view/observer/domeventobserver.js +5 -5
  180. package/src/view/observer/fakeselectionobserver.d.ts +9 -9
  181. package/src/view/observer/fakeselectionobserver.js +8 -8
  182. package/src/view/observer/focusobserver.d.ts +16 -16
  183. package/src/view/observer/focusobserver.js +7 -7
  184. package/src/view/observer/inputobserver.d.ts +18 -18
  185. package/src/view/observer/inputobserver.js +5 -5
  186. package/src/view/observer/keyobserver.d.ts +11 -11
  187. package/src/view/observer/keyobserver.js +3 -3
  188. package/src/view/observer/mouseobserver.d.ts +16 -16
  189. package/src/view/observer/mouseobserver.js +3 -3
  190. package/src/view/observer/mutationobserver.d.ts +21 -21
  191. package/src/view/observer/mutationobserver.js +7 -7
  192. package/src/view/observer/observer.d.ts +12 -12
  193. package/src/view/observer/observer.js +6 -6
  194. package/src/view/observer/selectionobserver.d.ts +33 -33
  195. package/src/view/observer/selectionobserver.js +14 -14
  196. package/src/view/observer/tabobserver.d.ts +10 -10
  197. package/src/view/observer/tabobserver.js +5 -5
  198. package/src/view/observer/touchobserver.d.ts +13 -13
  199. package/src/view/observer/touchobserver.js +3 -3
  200. package/src/view/placeholder.d.ts +21 -21
  201. package/src/view/placeholder.js +23 -23
  202. package/src/view/position.d.ts +49 -49
  203. package/src/view/position.js +42 -42
  204. package/src/view/range.d.ts +76 -74
  205. package/src/view/range.js +67 -65
  206. package/src/view/rawelement.d.ts +19 -19
  207. package/src/view/rawelement.js +16 -16
  208. package/src/view/renderer.d.ts +14 -14
  209. package/src/view/renderer.js +7 -7
  210. package/src/view/rooteditableelement.d.ts +8 -7
  211. package/src/view/rooteditableelement.js +7 -6
  212. package/src/view/selection.d.ts +66 -64
  213. package/src/view/selection.js +50 -48
  214. package/src/view/styles/background.d.ts +2 -2
  215. package/src/view/styles/background.js +9 -9
  216. package/src/view/styles/border.d.ts +2 -2
  217. package/src/view/styles/border.js +13 -13
  218. package/src/view/styles/margin.d.ts +2 -2
  219. package/src/view/styles/margin.js +5 -5
  220. package/src/view/styles/padding.d.ts +2 -2
  221. package/src/view/styles/padding.js +5 -5
  222. package/src/view/styles/utils.d.ts +24 -24
  223. package/src/view/styles/utils.js +25 -25
  224. package/src/view/stylesmap.d.ts +28 -32
  225. package/src/view/stylesmap.js +52 -39
  226. package/src/view/text.d.ts +11 -11
  227. package/src/view/text.js +10 -10
  228. package/src/view/textproxy.d.ts +33 -32
  229. package/src/view/textproxy.js +23 -22
  230. package/src/view/tokenlist.d.ts +14 -14
  231. package/src/view/tokenlist.js +10 -10
  232. package/src/view/treewalker.d.ts +42 -40
  233. package/src/view/treewalker.js +36 -35
  234. package/src/view/typecheckable.d.ts +76 -75
  235. package/src/view/typecheckable.js +1 -1
  236. package/src/view/uielement.d.ts +22 -21
  237. package/src/view/uielement.js +17 -16
  238. package/src/view/upcastwriter.d.ts +70 -70
  239. package/src/view/upcastwriter.js +42 -42
  240. package/src/view/view.d.ts +70 -69
  241. package/src/view/view.js +56 -55
@@ -5,23 +5,24 @@
5
5
  /**
6
6
  * @module engine/view/rooteditableelement
7
7
  */
8
- import EditableElement from './editableelement.js';
9
- import type Document from './document.js';
8
+ import { ViewEditableElement } from './editableelement.js';
9
+ import { type ViewDocument } from './document.js';
10
10
  /**
11
- * Class representing a single root in the data view. A root can be either {@link ~RootEditableElement#isReadOnly editable or read-only},
12
- * but in both cases it is called "an editable". Roots can contain other {@link module:engine/view/editableelement~EditableElement
11
+ * Class representing a single root in the data view. A root can be either
12
+ * {@link ~ViewRootEditableElement#isReadOnly editable or read-only},
13
+ * but in both cases it is called "an editable". Roots can contain other {@link module:engine/view/editableelement~ViewEditableElement
13
14
  * editable elements} making them "nested editables".
14
15
  */
15
- export default class RootEditableElement extends EditableElement {
16
+ export declare class ViewRootEditableElement extends ViewEditableElement {
16
17
  /**
17
18
  * Creates root editable element.
18
19
  *
19
20
  * @param document The document instance to which this element belongs.
20
21
  * @param name Node name.
21
22
  */
22
- constructor(document: Document, name: string);
23
+ constructor(document: ViewDocument, name: string);
23
24
  /**
24
- * Name of this root inside {@link module:engine/view/document~Document} that is an owner of this root. If no
25
+ * Name of this root inside {@link module:engine/view/document~ViewDocument} that is an owner of this root. If no
25
26
  * other name is set, `main` name is used.
26
27
  *
27
28
  * @readonly
@@ -5,14 +5,15 @@
5
5
  /**
6
6
  * @module engine/view/rooteditableelement
7
7
  */
8
- import EditableElement from './editableelement.js';
8
+ import { ViewEditableElement } from './editableelement.js';
9
9
  const rootNameSymbol = Symbol('rootName');
10
10
  /**
11
- * Class representing a single root in the data view. A root can be either {@link ~RootEditableElement#isReadOnly editable or read-only},
12
- * but in both cases it is called "an editable". Roots can contain other {@link module:engine/view/editableelement~EditableElement
11
+ * Class representing a single root in the data view. A root can be either
12
+ * {@link ~ViewRootEditableElement#isReadOnly editable or read-only},
13
+ * but in both cases it is called "an editable". Roots can contain other {@link module:engine/view/editableelement~ViewEditableElement
13
14
  * editable elements} making them "nested editables".
14
15
  */
15
- export default class RootEditableElement extends EditableElement {
16
+ export class ViewRootEditableElement extends ViewEditableElement {
16
17
  /**
17
18
  * Creates root editable element.
18
19
  *
@@ -24,7 +25,7 @@ export default class RootEditableElement extends EditableElement {
24
25
  this.rootName = 'main';
25
26
  }
26
27
  /**
27
- * Name of this root inside {@link module:engine/view/document~Document} that is an owner of this root. If no
28
+ * Name of this root inside {@link module:engine/view/document~ViewDocument} that is an owner of this root. If no
28
29
  * other name is set, `main` name is used.
29
30
  *
30
31
  * @readonly
@@ -50,7 +51,7 @@ export default class RootEditableElement extends EditableElement {
50
51
  }
51
52
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
52
53
  // Proper overload would interfere with that.
53
- RootEditableElement.prototype.is = function (type, name) {
54
+ ViewRootEditableElement.prototype.is = function (type, name) {
54
55
  if (!name) {
55
56
  return type === 'rootElement' || type === 'view:rootElement' ||
56
57
  // From super.is(). This is highly utilised method and cannot call super. See ckeditor/ckeditor5#6529.
@@ -5,28 +5,28 @@
5
5
  /**
6
6
  * @module engine/view/selection
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import Range from './range.js';
10
- import Position, { type PositionOffset } from './position.js';
11
- import Node from './node.js';
12
- import DocumentSelection from './documentselection.js';
13
- import type Element from './element.js';
14
- import type Item from './item.js';
15
- import type EditableElement from './editableelement.js';
16
- declare const Selection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof TypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import { ViewRange } from './range.js';
10
+ import { ViewPosition, type ViewPositionOffset } from './position.js';
11
+ import { ViewNode } from './node.js';
12
+ import { ViewDocumentSelection } from './documentselection.js';
13
+ import { type ViewElement } from './element.js';
14
+ import { type ViewItem } from './item.js';
15
+ import { type ViewEditableElement } from './editableelement.js';
16
+ declare const ViewSelection_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ViewTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
17
17
  /**
18
18
  * Class representing an arbirtary selection in the view.
19
- * See also {@link module:engine/view/documentselection~DocumentSelection}.
19
+ * See also {@link module:engine/view/documentselection~ViewDocumentSelection}.
20
20
  *
21
21
  * New selection instances can be created via the constructor or one these methods:
22
22
  *
23
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
24
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
23
+ * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},
24
+ * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.
25
25
  *
26
- * A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
27
- * the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
26
+ * A selection can consist of {@link module:engine/view/range~ViewRange ranges} that can be set by using
27
+ * the {@link module:engine/view/selection~ViewSelection#setTo `Selection#setTo()`} method.
28
28
  */
29
- export default class Selection extends /* #__PURE__ */ Selection_base {
29
+ export declare class ViewSelection extends /* #__PURE__ */ ViewSelection_base {
30
30
  /**
31
31
  * Stores all ranges that are selected.
32
32
  */
@@ -48,8 +48,8 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
48
48
  *
49
49
  * **Note**: The selection constructor is available as a factory method:
50
50
  *
51
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
52
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
51
+ * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},
52
+ * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.
53
53
  *
54
54
  * ```ts
55
55
  * // Creates empty selection without ranges.
@@ -78,11 +78,11 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
78
78
  * const paragraph = writer.createContainerElement( 'paragraph' );
79
79
  * const selection = writer.createSelection( paragraph, offset );
80
80
  *
81
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
81
+ * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
82
82
  * // first child of that element and ends after the last child of that element.
83
83
  * const selection = writer.createSelection( paragraph, 'in' );
84
84
  *
85
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
85
+ * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
86
86
  * // just after the item.
87
87
  * const selection = writer.createSelection( paragraph, 'on' );
88
88
  * ```
@@ -109,12 +109,12 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
109
109
  * @internal
110
110
  */
111
111
  constructor(...args: [] | [
112
- selectable: Node,
113
- placeOrOffset: PlaceOrOffset,
114
- options?: SelectionOptions
112
+ selectable: ViewNode,
113
+ placeOrOffset: ViewPlaceOrOffset,
114
+ options?: ViewSelectionOptions
115
115
  ] | [
116
- selectable?: Exclude<Selectable, Node>,
117
- options?: SelectionOptions
116
+ selectable?: Exclude<ViewSelectable, ViewNode>,
117
+ options?: ViewSelectionOptions
118
118
  ]);
119
119
  /**
120
120
  * Returns true if selection instance is marked as `fake`.
@@ -136,13 +136,13 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
136
136
  *
137
137
  * @see #focus
138
138
  */
139
- get anchor(): Position | null;
139
+ get anchor(): ViewPosition | null;
140
140
  /**
141
141
  * Selection focus. Focus is a position where the selection ends.
142
142
  *
143
143
  * @see #anchor
144
144
  */
145
- get focus(): Position | null;
145
+ get focus(): ViewPosition | null;
146
146
  /**
147
147
  * Returns whether the selection is collapsed. Selection is collapsed when there is exactly one range which is
148
148
  * collapsed.
@@ -157,39 +157,40 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
157
157
  */
158
158
  get isBackward(): boolean;
159
159
  /**
160
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`
160
+ * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`
161
161
  * if the selection is not inside an editable element.
162
162
  */
163
- get editableElement(): EditableElement | null;
163
+ get editableElement(): ViewEditableElement | null;
164
164
  /**
165
165
  * Returns an iterable that contains copies of all ranges added to the selection.
166
166
  */
167
- getRanges(): IterableIterator<Range>;
167
+ getRanges(): IterableIterator<ViewRange>;
168
168
  /**
169
169
  * Returns copy of the first range in the selection. First range is the one which
170
- * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start
170
+ * {@link module:engine/view/range~ViewRange#start start} position
171
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} start
171
172
  * position of all other ranges (not to confuse with the first range added to the selection).
172
173
  * Returns `null` if no ranges are added to selection.
173
174
  */
174
- getFirstRange(): Range | null;
175
+ getFirstRange(): ViewRange | null;
175
176
  /**
176
- * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}
177
- * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse
177
+ * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}
178
+ * position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse
178
179
  * with the last range added to the selection). Returns `null` if no ranges are added to selection.
179
180
  */
180
- getLastRange(): Range | null;
181
+ getLastRange(): ViewRange | null;
181
182
  /**
182
183
  * Returns copy of the first position in the selection. First position is the position that
183
- * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.
184
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.
184
185
  * Returns `null` if no ranges are added to selection.
185
186
  */
186
- getFirstPosition(): Position | null;
187
+ getFirstPosition(): ViewPosition | null;
187
188
  /**
188
189
  * Returns copy of the last position in the selection. Last position is the position that
189
- * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.
190
+ * {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.
190
191
  * Returns `null` if no ranges are added to selection.
191
192
  */
192
- getLastPosition(): Position | null;
193
+ getLastPosition(): ViewPosition | null;
193
194
  /**
194
195
  * Checks whether, this selection is equal to given selection. Selections are equal if they have same directions,
195
196
  * same number of ranges and all ranges from one selection equal to a range from other selection.
@@ -197,25 +198,25 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
197
198
  * @param otherSelection Selection to compare with.
198
199
  * @returns `true` if selections are equal, `false` otherwise.
199
200
  */
200
- isEqual(otherSelection: Selection | DocumentSelection): boolean;
201
+ isEqual(otherSelection: ViewSelection | ViewDocumentSelection): boolean;
201
202
  /**
202
203
  * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
203
- * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are
204
+ * number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are
204
205
  * equal to any trimmed range from other selection.
205
206
  *
206
207
  * @param otherSelection Selection to compare with.
207
208
  * @returns `true` if selections are similar, `false` otherwise.
208
209
  */
209
- isSimilar(otherSelection: Selection | DocumentSelection): boolean;
210
+ isSimilar(otherSelection: ViewSelection | ViewDocumentSelection): boolean;
210
211
  /**
211
- * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only
212
+ * Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only
212
213
  * one range in the selection, and that range contains exactly one element.
213
214
  * Returns `null` if there is no selected element.
214
215
  */
215
- getSelectedElement(): Element | null;
216
+ getSelectedElement(): ViewElement | null;
216
217
  /**
217
218
  * Sets this selection's ranges and direction to the specified location based on the given
218
- * {@link module:engine/view/selection~Selectable selectable}.
219
+ * {@link module:engine/view/selection~ViewSelectable selectable}.
219
220
  *
220
221
  * ```ts
221
222
  * // Sets selection to the given range.
@@ -230,7 +231,7 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
230
231
  * const otherSelection = writer.createSelection();
231
232
  * selection.setTo( otherSelection );
232
233
  *
233
- * // Sets selection to contents of DocumentSelection.
234
+ * // Sets selection to contents of ViewDocumentSelection.
234
235
  * selection.setTo( editor.editing.view.document.selection );
235
236
  *
236
237
  * // Sets collapsed selection at the given position.
@@ -241,14 +242,14 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
241
242
  * selection.setTo( paragraph, offset );
242
243
  * ```
243
244
  *
244
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
245
+ * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
245
246
  * that element and ends after the last child of that element.
246
247
  *
247
248
  * ```ts
248
249
  * selection.setTo( paragraph, 'in' );
249
250
  * ```
250
251
  *
251
- * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
252
+ * Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.
252
253
  *
253
254
  * ```ts
254
255
  * selection.setTo( paragraph, 'on' );
@@ -279,23 +280,24 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
279
280
  * @fires change
280
281
  */
281
282
  setTo(...args: [
282
- selectable: Node,
283
- placeOrOffset: PlaceOrOffset,
284
- options?: SelectionOptions
283
+ selectable: ViewNode,
284
+ placeOrOffset: ViewPlaceOrOffset,
285
+ options?: ViewSelectionOptions
285
286
  ] | [
286
- selectable?: Exclude<Selectable, Node>,
287
- options?: SelectionOptions
287
+ selectable?: Exclude<ViewSelectable, ViewNode>,
288
+ options?: ViewSelectionOptions
288
289
  ]): void;
289
290
  /**
290
291
  * Moves {@link #focus} to the specified location.
291
292
  *
292
- * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}
293
+ * The location can be specified in the same form as
294
+ * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}
293
295
  * parameters.
294
296
  *
295
297
  * @fires change
296
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
298
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
297
299
  */
298
- setFocus(itemOrPosition: Item | Position, offset?: PositionOffset): void;
300
+ setFocus(itemOrPosition: ViewItem | ViewPosition, offset?: ViewPositionOffset): void;
299
301
  /**
300
302
  * Replaces all ranges that were added to the selection with given array of ranges. Last range of the array
301
303
  * is treated like the last added range and is used to set {@link #anchor anchor} and {@link #focus focus}.
@@ -320,8 +322,8 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
320
322
  * selection instance and you can safely operate on it.
321
323
  *
322
324
  * Accepts a flag describing in which way the selection is made - passed range might be selected from
323
- * {@link module:engine/view/range~Range#start start} to {@link module:engine/view/range~Range#end end}
324
- * or from {@link module:engine/view/range~Range#end end} to {@link module:engine/view/range~Range#start start}.
325
+ * {@link module:engine/view/range~ViewRange#start start} to {@link module:engine/view/range~ViewRange#end end}
326
+ * or from {@link module:engine/view/range~ViewRange#end end} to {@link module:engine/view/range~ViewRange#start start}.
325
327
  * The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.
326
328
  *
327
329
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
@@ -337,9 +339,9 @@ export default class Selection extends /* #__PURE__ */ Selection_base {
337
339
  private _pushRange;
338
340
  }
339
341
  /**
340
- * Additional options for {@link ~Selection}.
342
+ * Additional options for {@link ~ViewSelection}.
341
343
  */
342
- export interface SelectionOptions {
344
+ export interface ViewSelectionOptions {
343
345
  /**
344
346
  * Sets this selection instance to be backward.
345
347
  */
@@ -356,11 +358,11 @@ export interface SelectionOptions {
356
358
  /**
357
359
  * The place or offset of the selection.
358
360
  */
359
- export type PlaceOrOffset = number | 'before' | 'end' | 'after' | 'on' | 'in';
361
+ export type ViewPlaceOrOffset = number | 'before' | 'end' | 'after' | 'on' | 'in';
360
362
  /**
361
- * Fired whenever selection ranges are changed through {@link ~Selection Selection API}.
363
+ * Fired whenever selection ranges are changed through {@link ~ViewSelection Selection API}.
362
364
  *
363
- * @eventName ~Selection#change
365
+ * @eventName ~ViewSelection#change
364
366
  */
365
367
  export type ViewSelectionChangeEvent = {
366
368
  name: 'change';
@@ -369,7 +371,7 @@ export type ViewSelectionChangeEvent = {
369
371
  /**
370
372
  * An entity that is used to set selection.
371
373
  *
372
- * See also {@link module:engine/view/selection~Selection#setTo}
374
+ * See also {@link module:engine/view/selection~ViewSelection#setTo}
373
375
  */
374
- export type Selectable = Selection | DocumentSelection | Position | Iterable<Range> | Range | Node | null;
376
+ export type ViewSelectable = ViewSelection | ViewDocumentSelection | ViewPosition | Iterable<ViewRange> | ViewRange | ViewNode | null;
375
377
  export {};
@@ -5,25 +5,25 @@
5
5
  /**
6
6
  * @module engine/view/selection
7
7
  */
8
- import TypeCheckable from './typecheckable.js';
9
- import Range from './range.js';
10
- import Position from './position.js';
11
- import Node from './node.js';
12
- import DocumentSelection from './documentselection.js';
8
+ import { ViewTypeCheckable } from './typecheckable.js';
9
+ import { ViewRange } from './range.js';
10
+ import { ViewPosition } from './position.js';
11
+ import { ViewNode } from './node.js';
12
+ import { ViewDocumentSelection } from './documentselection.js';
13
13
  import { CKEditorError, EmitterMixin, count, isIterable } from '@ckeditor/ckeditor5-utils';
14
14
  /**
15
15
  * Class representing an arbirtary selection in the view.
16
- * See also {@link module:engine/view/documentselection~DocumentSelection}.
16
+ * See also {@link module:engine/view/documentselection~ViewDocumentSelection}.
17
17
  *
18
18
  * New selection instances can be created via the constructor or one these methods:
19
19
  *
20
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
21
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
20
+ * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},
21
+ * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.
22
22
  *
23
- * A selection can consist of {@link module:engine/view/range~Range ranges} that can be set by using
24
- * the {@link module:engine/view/selection~Selection#setTo `Selection#setTo()`} method.
23
+ * A selection can consist of {@link module:engine/view/range~ViewRange ranges} that can be set by using
24
+ * the {@link module:engine/view/selection~ViewSelection#setTo `Selection#setTo()`} method.
25
25
  */
26
- export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckable) {
26
+ export class ViewSelection extends /* #__PURE__ */ EmitterMixin(ViewTypeCheckable) {
27
27
  /**
28
28
  * Stores all ranges that are selected.
29
29
  */
@@ -45,8 +45,8 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
45
45
  *
46
46
  * **Note**: The selection constructor is available as a factory method:
47
47
  *
48
- * * {@link module:engine/view/view~View#createSelection `View#createSelection()`},
49
- * * {@link module:engine/view/upcastwriter~UpcastWriter#createSelection `UpcastWriter#createSelection()`}.
48
+ * * {@link module:engine/view/view~EditingView#createSelection `View#createSelection()`},
49
+ * * {@link module:engine/view/upcastwriter~ViewUpcastWriter#createSelection `UpcastWriter#createSelection()`}.
50
50
  *
51
51
  * ```ts
52
52
  * // Creates empty selection without ranges.
@@ -75,11 +75,11 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
75
75
  * const paragraph = writer.createContainerElement( 'paragraph' );
76
76
  * const selection = writer.createSelection( paragraph, offset );
77
77
  *
78
- * // Creates a range inside an {@link module:engine/view/element~Element element} which starts before the
78
+ * // Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the
79
79
  * // first child of that element and ends after the last child of that element.
80
80
  * const selection = writer.createSelection( paragraph, 'in' );
81
81
  *
82
- * // Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends
82
+ * // Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends
83
83
  * // just after the item.
84
84
  * const selection = writer.createSelection( paragraph, 'on' );
85
85
  * ```
@@ -180,7 +180,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
180
180
  return !this.isCollapsed && this._lastRangeBackward;
181
181
  }
182
182
  /**
183
- * {@link module:engine/view/editableelement~EditableElement EditableElement} instance that contains this selection, or `null`
183
+ * {@link module:engine/view/editableelement~ViewEditableElement ViewEditableElement} instance that contains this selection, or `null`
184
184
  * if the selection is not inside an editable element.
185
185
  */
186
186
  get editableElement() {
@@ -199,7 +199,8 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
199
199
  }
200
200
  /**
201
201
  * Returns copy of the first range in the selection. First range is the one which
202
- * {@link module:engine/view/range~Range#start start} position {@link module:engine/view/position~Position#isBefore is before} start
202
+ * {@link module:engine/view/range~ViewRange#start start} position
203
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} start
203
204
  * position of all other ranges (not to confuse with the first range added to the selection).
204
205
  * Returns `null` if no ranges are added to selection.
205
206
  */
@@ -213,8 +214,8 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
213
214
  return first ? first.clone() : null;
214
215
  }
215
216
  /**
216
- * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~Range#end end}
217
- * position {@link module:engine/view/position~Position#isAfter is after} end position of all other ranges (not to confuse
217
+ * Returns copy of the last range in the selection. Last range is the one which {@link module:engine/view/range~ViewRange#end end}
218
+ * position {@link module:engine/view/position~ViewPosition#isAfter is after} end position of all other ranges (not to confuse
218
219
  * with the last range added to the selection). Returns `null` if no ranges are added to selection.
219
220
  */
220
221
  getLastRange() {
@@ -228,7 +229,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
228
229
  }
229
230
  /**
230
231
  * Returns copy of the first position in the selection. First position is the position that
231
- * {@link module:engine/view/position~Position#isBefore is before} any other position in the selection ranges.
232
+ * {@link module:engine/view/position~ViewPosition#isBefore is before} any other position in the selection ranges.
232
233
  * Returns `null` if no ranges are added to selection.
233
234
  */
234
235
  getFirstPosition() {
@@ -237,7 +238,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
237
238
  }
238
239
  /**
239
240
  * Returns copy of the last position in the selection. Last position is the position that
240
- * {@link module:engine/view/position~Position#isAfter is after} any other position in the selection ranges.
241
+ * {@link module:engine/view/position~ViewPosition#isAfter is after} any other position in the selection ranges.
241
242
  * Returns `null` if no ranges are added to selection.
242
243
  */
243
244
  getLastPosition() {
@@ -283,7 +284,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
283
284
  }
284
285
  /**
285
286
  * Checks whether this selection is similar to given selection. Selections are similar if they have same directions, same
286
- * number of ranges, and all {@link module:engine/view/range~Range#getTrimmed trimmed} ranges from one selection are
287
+ * number of ranges, and all {@link module:engine/view/range~ViewRange#getTrimmed trimmed} ranges from one selection are
287
288
  * equal to any trimmed range from other selection.
288
289
  *
289
290
  * @param otherSelection Selection to compare with.
@@ -323,7 +324,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
323
324
  return true;
324
325
  }
325
326
  /**
326
- * Returns the selected element. {@link module:engine/view/element~Element Element} is considered as selected if there is only
327
+ * Returns the selected element. {@link module:engine/view/element~ViewElement Element} is considered as selected if there is only
327
328
  * one range in the selection, and that range contains exactly one element.
328
329
  * Returns `null` if there is no selected element.
329
330
  */
@@ -335,7 +336,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
335
336
  }
336
337
  /**
337
338
  * Sets this selection's ranges and direction to the specified location based on the given
338
- * {@link module:engine/view/selection~Selectable selectable}.
339
+ * {@link module:engine/view/selection~ViewSelectable selectable}.
339
340
  *
340
341
  * ```ts
341
342
  * // Sets selection to the given range.
@@ -350,7 +351,7 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
350
351
  * const otherSelection = writer.createSelection();
351
352
  * selection.setTo( otherSelection );
352
353
  *
353
- * // Sets selection to contents of DocumentSelection.
354
+ * // Sets selection to contents of ViewDocumentSelection.
354
355
  * selection.setTo( editor.editing.view.document.selection );
355
356
  *
356
357
  * // Sets collapsed selection at the given position.
@@ -361,14 +362,14 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
361
362
  * selection.setTo( paragraph, offset );
362
363
  * ```
363
364
  *
364
- * Creates a range inside an {@link module:engine/view/element~Element element} which starts before the first child of
365
+ * Creates a range inside an {@link module:engine/view/element~ViewElement element} which starts before the first child of
365
366
  * that element and ends after the last child of that element.
366
367
  *
367
368
  * ```ts
368
369
  * selection.setTo( paragraph, 'in' );
369
370
  * ```
370
371
  *
371
- * Creates a range on an {@link module:engine/view/item~Item item} which starts before the item and ends just after the item.
372
+ * Creates a range on an {@link module:engine/view/item~ViewItem item} which starts before the item and ends just after the item.
372
373
  *
373
374
  * ```ts
374
375
  * selection.setTo( paragraph, 'on' );
@@ -408,19 +409,19 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
408
409
  this._setRanges([]);
409
410
  this._setFakeOptions(options);
410
411
  }
411
- else if (selectable instanceof Selection || selectable instanceof DocumentSelection) {
412
+ else if (selectable instanceof ViewSelection || selectable instanceof ViewDocumentSelection) {
412
413
  this._setRanges(selectable.getRanges(), selectable.isBackward);
413
414
  this._setFakeOptions({ fake: selectable.isFake, label: selectable.fakeSelectionLabel });
414
415
  }
415
- else if (selectable instanceof Range) {
416
+ else if (selectable instanceof ViewRange) {
416
417
  this._setRanges([selectable], options && options.backward);
417
418
  this._setFakeOptions(options);
418
419
  }
419
- else if (selectable instanceof Position) {
420
- this._setRanges([new Range(selectable)]);
420
+ else if (selectable instanceof ViewPosition) {
421
+ this._setRanges([new ViewRange(selectable)]);
421
422
  this._setFakeOptions(options);
422
423
  }
423
- else if (selectable instanceof Node) {
424
+ else if (selectable instanceof ViewNode) {
424
425
  const backward = !!options && !!options.backward;
425
426
  let range;
426
427
  if (placeOrOffset === undefined) {
@@ -432,13 +433,13 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
432
433
  throw new CKEditorError('view-selection-setto-required-second-parameter', this);
433
434
  }
434
435
  else if (placeOrOffset == 'in') {
435
- range = Range._createIn(selectable);
436
+ range = ViewRange._createIn(selectable);
436
437
  }
437
438
  else if (placeOrOffset == 'on') {
438
- range = Range._createOn(selectable);
439
+ range = ViewRange._createOn(selectable);
439
440
  }
440
441
  else {
441
- range = new Range(Position._createAt(selectable, placeOrOffset));
442
+ range = new ViewRange(ViewPosition._createAt(selectable, placeOrOffset));
442
443
  }
443
444
  this._setRanges([range], backward);
444
445
  this._setFakeOptions(options);
@@ -462,11 +463,12 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
462
463
  /**
463
464
  * Moves {@link #focus} to the specified location.
464
465
  *
465
- * The location can be specified in the same form as {@link module:engine/view/view~View#createPositionAt view.createPositionAt()}
466
+ * The location can be specified in the same form as
467
+ * {@link module:engine/view/view~EditingView#createPositionAt view.createPositionAt()}
466
468
  * parameters.
467
469
  *
468
470
  * @fires change
469
- * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~Item view item}.
471
+ * @param offset Offset or one of the flags. Used only when first parameter is a {@link module:engine/view/item~ViewItem view item}.
470
472
  */
471
473
  setFocus(itemOrPosition, offset) {
472
474
  if (this.anchor === null) {
@@ -477,17 +479,17 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
477
479
  */
478
480
  throw new CKEditorError('view-selection-setfocus-no-ranges', this);
479
481
  }
480
- const newFocus = Position._createAt(itemOrPosition, offset);
482
+ const newFocus = ViewPosition._createAt(itemOrPosition, offset);
481
483
  if (newFocus.compareWith(this.focus) == 'same') {
482
484
  return;
483
485
  }
484
486
  const anchor = this.anchor;
485
487
  this._ranges.pop();
486
488
  if (newFocus.compareWith(anchor) == 'before') {
487
- this._addRange(new Range(newFocus, anchor), true);
489
+ this._addRange(new ViewRange(newFocus, anchor), true);
488
490
  }
489
491
  else {
490
- this._addRange(new Range(anchor, newFocus));
492
+ this._addRange(new ViewRange(anchor, newFocus));
491
493
  }
492
494
  this.fire('change');
493
495
  }
@@ -527,17 +529,17 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
527
529
  * selection instance and you can safely operate on it.
528
530
  *
529
531
  * Accepts a flag describing in which way the selection is made - passed range might be selected from
530
- * {@link module:engine/view/range~Range#start start} to {@link module:engine/view/range~Range#end end}
531
- * or from {@link module:engine/view/range~Range#end end} to {@link module:engine/view/range~Range#start start}.
532
+ * {@link module:engine/view/range~ViewRange#start start} to {@link module:engine/view/range~ViewRange#end end}
533
+ * or from {@link module:engine/view/range~ViewRange#end end} to {@link module:engine/view/range~ViewRange#start start}.
532
534
  * The flag is used to set {@link #anchor anchor} and {@link #focus focus} properties.
533
535
  *
534
536
  * Throws {@link module:utils/ckeditorerror~CKEditorError CKEditorError} `view-selection-range-intersects` if added range intersects
535
537
  * with ranges already stored in Selection instance.
536
538
  */
537
539
  _addRange(range, isBackward = false) {
538
- if (!(range instanceof Range)) {
540
+ if (!(range instanceof ViewRange)) {
539
541
  /**
540
- * Selection range set to an object that is not an instance of {@link module:engine/view/range~Range}.
542
+ * Selection range set to an object that is not an instance of {@link module:engine/view/range~ViewRange}.
541
543
  *
542
544
  * @error view-selection-add-range-not-range
543
545
  */
@@ -559,17 +561,17 @@ export default class Selection extends /* #__PURE__ */ EmitterMixin(TypeCheckabl
559
561
  * Trying to add a range that intersects with another range from selection.
560
562
  *
561
563
  * @error view-selection-range-intersects
562
- * @param {module:engine/view/range~Range} addedRange Range that was added to the selection.
563
- * @param {module:engine/view/range~Range} intersectingRange Range from selection that intersects with `addedRange`.
564
+ * @param {module:engine/view/range~ViewRange} addedRange Range that was added to the selection.
565
+ * @param {module:engine/view/range~ViewRange} intersectingRange Range from selection that intersects with `addedRange`.
564
566
  */
565
567
  throw new CKEditorError('view-selection-range-intersects', this, { addedRange: range, intersectingRange: storedRange });
566
568
  }
567
569
  }
568
- this._ranges.push(new Range(range.start, range.end));
570
+ this._ranges.push(new ViewRange(range.start, range.end));
569
571
  }
570
572
  }
571
573
  // The magic of type inference using `is` method is centralized in `TypeCheckable` class.
572
574
  // Proper overload would interfere with that.
573
- Selection.prototype.is = function (type) {
575
+ ViewSelection.prototype.is = function (type) {
574
576
  return type === 'selection' || type === 'view:selection';
575
577
  };