@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,342 +1,335 @@
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/markercollection
7
- */
8
- import { ModelTypeCheckable } from './typecheckable.js';
9
- import { ModelLiveRange, type ModelLiveRangeChangeContentEvent, type ModelLiveRangeChangeRangeEvent, type ModelLiveRangeChangeEvent } from './liverange.js';
10
- import { type ModelPosition } from './position.js';
11
- import { type ModelRange } from './range.js';
12
- declare const MarkerCollection_base: {
13
- new (): import("@ckeditor/ckeditor5-utils").Emitter;
14
- prototype: import("@ckeditor/ckeditor5-utils").Emitter;
15
- };
6
+ * @module engine/model/markercollection
7
+ */
8
+ import { ModelTypeCheckable } from "./typecheckable.js";
9
+ import { ModelLiveRange, type ModelLiveRangeChangeContentEvent, type ModelLiveRangeChangeRangeEvent, type ModelLiveRangeChangeEvent } from "./liverange.js";
10
+ import { type ModelPosition } from "./position.js";
11
+ import { type ModelRange } from "./range.js";
12
+ import { type EmitterMixinConstructor } from "@ckeditor/ckeditor5-utils";
13
+ declare const MarkerCollectionBase: EmitterMixinConstructor;
14
+ declare const MarkerBase: EmitterMixinConstructor<typeof ModelTypeCheckable>;
16
15
  /**
17
- * The collection of all {@link module:engine/model/markercollection~Marker markers} attached to the document.
18
- * It lets you {@link module:engine/model/markercollection~MarkerCollection#get get} markers or track them using
19
- * {@link module:engine/model/markercollection~MarkerCollection#event:update} event.
20
- *
21
- * To create, change or remove makers use {@link module:engine/model/writer~ModelWriter model writers'} methods:
22
- * {@link module:engine/model/writer~ModelWriter#addMarker} or {@link module:engine/model/writer~ModelWriter#removeMarker}. Since
23
- * the writer is the only proper way to change the data model it is not possible to change markers directly using this
24
- * collection. All markers created by the writer will be automatically added to this collection.
25
- *
26
- * By default there is one marker collection available as {@link module:engine/model/model~Model#markers model property}.
27
- *
28
- * @see module:engine/model/markercollection~Marker
29
- */
30
- export declare class MarkerCollection extends /* #__PURE__ */ MarkerCollection_base implements Iterable<Marker> {
31
- /**
32
- * Stores {@link ~Marker markers} added to the collection.
33
- */
34
- private _markers;
35
- /**
36
- * Iterable interface.
37
- *
38
- * Iterates over all {@link ~Marker markers} added to the collection.
39
- */
40
- [Symbol.iterator](): IterableIterator<Marker>;
41
- /**
42
- * Checks if given {@link ~Marker marker} or marker name is in the collection.
43
- *
44
- * @param markerOrName Name of marker or marker instance to check.
45
- * @returns `true` if marker is in the collection, `false` otherwise.
46
- */
47
- has(markerOrName: string | Marker): boolean;
48
- /**
49
- * Returns {@link ~Marker marker} with given `markerName`.
50
- *
51
- * @param markerName Name of marker to get.
52
- * @returns Marker with given name or `null` if such marker was
53
- * not added to the collection.
54
- */
55
- get(markerName: string): Marker | null;
56
- /**
57
- * Creates and adds a {@link ~Marker marker} to the `MarkerCollection` with given name on given
58
- * {@link module:engine/model/range~ModelRange range}.
59
- *
60
- * If `MarkerCollection` already had a marker with given name (or {@link ~Marker marker} was passed), the marker in
61
- * collection is updated and {@link module:engine/model/markercollection~MarkerCollection#event:update} event is fired
62
- * but only if there was a change (marker range or {@link module:engine/model/markercollection~Marker#managedUsingOperations}
63
- * flag has changed.
64
- *
65
- * @internal
66
- * @fires update
67
- * @param markerOrName Name of marker to set or marker instance to update.
68
- * @param range Marker range.
69
- * @param managedUsingOperations Specifies whether the marker is managed using operations.
70
- * @param affectsData Specifies whether the marker affects the data produced by the data pipeline
71
- * (is persisted in the editor's data).
72
- * @returns `Marker` instance which was added or updated.
73
- */
74
- _set(markerOrName: string | Marker, range: ModelRange, managedUsingOperations?: boolean, affectsData?: boolean): Marker;
75
- /**
76
- * Removes given {@link ~Marker marker} or a marker with given name from the `MarkerCollection`.
77
- *
78
- * @internal
79
- * @fires update
80
- * @param markerOrName Marker or name of a marker to remove.
81
- * @returns `true` if marker was found and removed, `false` otherwise.
82
- */
83
- _remove(markerOrName: string | Marker): boolean;
84
- /**
85
- * Fires an {@link module:engine/model/markercollection~MarkerCollection#event:update} event for the given {@link ~Marker marker}
86
- * but does not change the marker. Useful to force {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast
87
- * conversion} for the marker.
88
- *
89
- * @internal
90
- * @fires update
91
- * @param markerOrName Marker or name of a marker to refresh.
92
- */
93
- _refresh(markerOrName: string | Marker): void;
94
- /**
95
- * Returns iterator that iterates over all markers, which ranges
96
- * contain given {@link module:engine/model/position~ModelPosition position}.
97
- */
98
- getMarkersAtPosition(position: ModelPosition): IterableIterator<Marker>;
99
- /**
100
- * Returns iterator that iterates over all markers, which intersects with given {@link module:engine/model/range~ModelRange range}.
101
- */
102
- getMarkersIntersectingRange(range: ModelRange): Iterable<Marker>;
103
- /**
104
- * Destroys marker collection and all markers inside it.
105
- */
106
- destroy(): void;
107
- /**
108
- * Iterates over all markers that starts with given `prefix`.
109
- *
110
- * ```ts
111
- * const markerFooA = markersCollection._set( 'foo:a', rangeFooA );
112
- * const markerFooB = markersCollection._set( 'foo:b', rangeFooB );
113
- * const markerBarA = markersCollection._set( 'bar:a', rangeBarA );
114
- * const markerFooBarA = markersCollection._set( 'foobar:a', rangeFooBarA );
115
- * Array.from( markersCollection.getMarkersGroup( 'foo' ) ); // [ markerFooA, markerFooB ]
116
- * Array.from( markersCollection.getMarkersGroup( 'a' ) ); // []
117
- * ```
118
- */
119
- getMarkersGroup(prefix: string): IterableIterator<Marker>;
120
- /**
121
- * Destroys the marker.
122
- */
123
- private _destroyMarker;
16
+ * The collection of all {@link module:engine/model/markercollection~Marker markers} attached to the document.
17
+ * It lets you {@link module:engine/model/markercollection~MarkerCollection#get get} markers or track them using
18
+ * {@link module:engine/model/markercollection~MarkerCollection#event:update} event.
19
+ *
20
+ * To create, change or remove makers use {@link module:engine/model/writer~ModelWriter model writers'} methods:
21
+ * {@link module:engine/model/writer~ModelWriter#addMarker} or {@link module:engine/model/writer~ModelWriter#removeMarker}. Since
22
+ * the writer is the only proper way to change the data model it is not possible to change markers directly using this
23
+ * collection. All markers created by the writer will be automatically added to this collection.
24
+ *
25
+ * By default there is one marker collection available as {@link module:engine/model/model~Model#markers model property}.
26
+ *
27
+ * @see module:engine/model/markercollection~Marker
28
+ */
29
+ export declare class MarkerCollection extends MarkerCollectionBase implements Iterable<Marker> {
30
+ /**
31
+ * Stores {@link ~Marker markers} added to the collection.
32
+ */
33
+ private _markers;
34
+ /**
35
+ * Iterable interface.
36
+ *
37
+ * Iterates over all {@link ~Marker markers} added to the collection.
38
+ */
39
+ [Symbol.iterator](): IterableIterator<Marker>;
40
+ /**
41
+ * Checks if given {@link ~Marker marker} or marker name is in the collection.
42
+ *
43
+ * @param markerOrName Name of marker or marker instance to check.
44
+ * @returns `true` if marker is in the collection, `false` otherwise.
45
+ */
46
+ has(markerOrName: string | Marker): boolean;
47
+ /**
48
+ * Returns {@link ~Marker marker} with given `markerName`.
49
+ *
50
+ * @param markerName Name of marker to get.
51
+ * @returns Marker with given name or `null` if such marker was
52
+ * not added to the collection.
53
+ */
54
+ get(markerName: string): Marker | null;
55
+ /**
56
+ * Creates and adds a {@link ~Marker marker} to the `MarkerCollection` with given name on given
57
+ * {@link module:engine/model/range~ModelRange range}.
58
+ *
59
+ * If `MarkerCollection` already had a marker with given name (or {@link ~Marker marker} was passed), the marker in
60
+ * collection is updated and {@link module:engine/model/markercollection~MarkerCollection#event:update} event is fired
61
+ * but only if there was a change (marker range or {@link module:engine/model/markercollection~Marker#managedUsingOperations}
62
+ * flag has changed.
63
+ *
64
+ * @internal
65
+ * @fires update
66
+ * @param markerOrName Name of marker to set or marker instance to update.
67
+ * @param range Marker range.
68
+ * @param managedUsingOperations Specifies whether the marker is managed using operations.
69
+ * @param affectsData Specifies whether the marker affects the data produced by the data pipeline
70
+ * (is persisted in the editor's data).
71
+ * @returns `Marker` instance which was added or updated.
72
+ */
73
+ _set(markerOrName: string | Marker, range: ModelRange, managedUsingOperations?: boolean, affectsData?: boolean): Marker;
74
+ /**
75
+ * Removes given {@link ~Marker marker} or a marker with given name from the `MarkerCollection`.
76
+ *
77
+ * @internal
78
+ * @fires update
79
+ * @param markerOrName Marker or name of a marker to remove.
80
+ * @returns `true` if marker was found and removed, `false` otherwise.
81
+ */
82
+ _remove(markerOrName: string | Marker): boolean;
83
+ /**
84
+ * Fires an {@link module:engine/model/markercollection~MarkerCollection#event:update} event for the given {@link ~Marker marker}
85
+ * but does not change the marker. Useful to force {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher downcast
86
+ * conversion} for the marker.
87
+ *
88
+ * @internal
89
+ * @fires update
90
+ * @param markerOrName Marker or name of a marker to refresh.
91
+ */
92
+ _refresh(markerOrName: string | Marker): void;
93
+ /**
94
+ * Returns iterator that iterates over all markers, which ranges
95
+ * contain given {@link module:engine/model/position~ModelPosition position}.
96
+ */
97
+ getMarkersAtPosition(position: ModelPosition): IterableIterator<Marker>;
98
+ /**
99
+ * Returns iterator that iterates over all markers, which intersects with given {@link module:engine/model/range~ModelRange range}.
100
+ */
101
+ getMarkersIntersectingRange(range: ModelRange): Iterable<Marker>;
102
+ /**
103
+ * Destroys marker collection and all markers inside it.
104
+ */
105
+ destroy(): void;
106
+ /**
107
+ * Iterates over all markers that starts with given `prefix`.
108
+ *
109
+ * ```ts
110
+ * const markerFooA = markersCollection._set( 'foo:a', rangeFooA );
111
+ * const markerFooB = markersCollection._set( 'foo:b', rangeFooB );
112
+ * const markerBarA = markersCollection._set( 'bar:a', rangeBarA );
113
+ * const markerFooBarA = markersCollection._set( 'foobar:a', rangeFooBarA );
114
+ * Array.from( markersCollection.getMarkersGroup( 'foo' ) ); // [ markerFooA, markerFooB ]
115
+ * Array.from( markersCollection.getMarkersGroup( 'a' ) ); // []
116
+ * ```
117
+ */
118
+ getMarkersGroup(prefix: string): IterableIterator<Marker>;
119
+ /**
120
+ * Destroys the marker.
121
+ */
122
+ private _destroyMarker;
124
123
  }
125
124
  export interface MarkerData {
126
- /**
127
- * Marker range. `null` if the marker was removed.
128
- */
129
- range: ModelRange | null;
130
- /**
131
- * A property defining if the marker affects data.
132
- */
133
- affectsData: boolean;
134
- /**
135
- * A property defining if the marker is managed using operations.
136
- */
137
- managedUsingOperations: boolean;
125
+ /**
126
+ * Marker range. `null` if the marker was removed.
127
+ */
128
+ range: ModelRange | null;
129
+ /**
130
+ * A property defining if the marker affects data.
131
+ */
132
+ affectsData: boolean;
133
+ /**
134
+ * A property defining if the marker is managed using operations.
135
+ */
136
+ managedUsingOperations: boolean;
138
137
  }
139
- declare const Marker_base: import("@ckeditor/ckeditor5-utils").Mixed<typeof ModelTypeCheckable, import("@ckeditor/ckeditor5-utils").Emitter>;
140
138
  /**
141
- * `Marker` is a continuous part of the model (like a range), is named and represents some kind of information about the
142
- * marked part of the model document. In contrary to {@link module:engine/model/node~ModelNode nodes}, which are building blocks of
143
- * the model document tree, markers are not stored directly in the document tree but in the
144
- * {@link module:engine/model/model~Model#markers model markers' collection}. Still, they are document data, by giving
145
- * additional meaning to the part of a model document between marker start and marker end.
146
- *
147
- * In this sense, markers are similar to adding and converting attributes on nodes. The difference is that attribute is
148
- * connected with a given node (e.g. a character is bold no matter if it gets moved or content around it changes).
149
- * Markers on the other hand are continuous ranges and are characterized by their start and end position. This means that
150
- * any character in the marker is marked by the marker. For example, if a character is moved outside of marker it stops being
151
- * "special" and the marker is shrunk. Similarly, when a character is moved into the marker from other place in document
152
- * model, it starts being "special" and the marker is enlarged.
153
- *
154
- * Another upside of markers is that finding marked part of document is fast and easy. Using attributes to mark some nodes
155
- * and then trying to find that part of document would require traversing whole document tree. Marker gives instant access
156
- * to the range which it is marking at the moment.
157
- *
158
- * Markers are built from a name and a range.
159
- *
160
- * Range of the marker is updated automatically when document changes, using
161
- * {@link module:engine/model/liverange~ModelLiveRange live range} mechanism.
162
- *
163
- * Name is used to group and identify markers. Names have to be unique, but markers can be grouped by
164
- * using common prefixes, separated with `:`, for example: `user:john` or `search:3`. That's useful in term of creating
165
- * namespaces for custom elements (e.g. comments, highlights). You can use this prefixes in
166
- * {@link module:engine/model/markercollection~MarkerCollection#event:update} listeners to listen on changes in a group of markers.
167
- * For instance: `model.markers.on( 'update:user', callback );` will be called whenever any `user:*` markers changes.
168
- *
169
- * There are two types of markers.
170
- *
171
- * 1. Markers managed directly, without using operations. They are added directly by {@link module:engine/model/writer~ModelWriter}
172
- * to the {@link module:engine/model/markercollection~MarkerCollection} without any additional mechanism. They can be used
173
- * as bookmarks or visual markers. They are great for showing results of the find, or select link when the focus is in the input.
174
- *
175
- * 1. Markers managed using operations. These markers are also stored in {@link module:engine/model/markercollection~MarkerCollection}
176
- * but changes in these markers is managed the same way all other changes in the model structure - using operations.
177
- * Therefore, they are handled in the undo stack and synchronized between clients if the collaboration plugin is enabled.
178
- * This type of markers is useful for solutions like spell checking or comments.
179
- *
180
- * Both type of them should be added / updated by {@link module:engine/model/writer~ModelWriter#addMarker}
181
- * and removed by {@link module:engine/model/writer~ModelWriter#removeMarker} methods.
182
- *
183
- * ```ts
184
- * model.change( ( writer ) => {
185
- * const marker = writer.addMarker( name, { range, usingOperation: true } );
186
- *
187
- * // ...
188
- *
189
- * writer.removeMarker( marker );
190
- * } );
191
- * ```
192
- *
193
- * See {@link module:engine/model/writer~ModelWriter} to find more examples.
194
- *
195
- * Since markers need to track change in the document, for efficiency reasons, it is best to create and keep as little
196
- * markers as possible and remove them as soon as they are not needed anymore.
197
- *
198
- * Markers can be downcasted and upcasted.
199
- *
200
- * Markers downcast happens on {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker} and
201
- * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:removeMarker} events.
202
- * Use {@link module:engine/conversion/downcasthelpers downcast converters} or attach a custom converter to mentioned events.
203
- * For {@link module:engine/controller/datacontroller~DataController data pipeline}, marker should be downcasted to an element.
204
- * Then, it can be upcasted back to a marker. Again, use {@link module:engine/conversion/upcasthelpers upcast converters} or
205
- * attach a custom converter to {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element}.
206
- *
207
- * `Marker` instances are created and destroyed only by {@link ~MarkerCollection MarkerCollection}.
208
- */
209
- declare class Marker extends /* #__PURE__ */ Marker_base {
210
- /**
211
- * Marker's name.
212
- */
213
- readonly name: string;
214
- /**
215
- * Flag indicates if the marker is managed using operations or not.
216
- *
217
- * @internal
218
- */
219
- _managedUsingOperations: boolean;
220
- /**
221
- * Specifies whether the marker affects the data produced by the data pipeline
222
- * (is persisted in the editor's data).
223
- *
224
- * @internal
225
- */
226
- _affectsData: boolean;
227
- /**
228
- * Range marked by the marker.
229
- */
230
- private _liveRange;
231
- /**
232
- * Creates a marker instance.
233
- *
234
- * @param name Marker name.
235
- * @param liveRange Range marked by the marker.
236
- * @param managedUsingOperations Specifies whether the marker is managed using operations.
237
- * @param affectsData Specifies whether the marker affects the data produced by the data pipeline (is persisted in the editor's data).
238
- */
239
- constructor(name: string, liveRange: ModelLiveRange, managedUsingOperations: boolean, affectsData: boolean);
240
- /**
241
- * A value indicating if the marker is managed using operations.
242
- * See {@link ~Marker marker class description} to learn more about marker types.
243
- * See {@link module:engine/model/writer~ModelWriter#addMarker}.
244
- */
245
- get managedUsingOperations(): boolean;
246
- /**
247
- * A value indicating if the marker changes the data.
248
- */
249
- get affectsData(): boolean;
250
- /**
251
- * Returns the marker data (properties defining the marker).
252
- */
253
- getData(): MarkerData;
254
- /**
255
- * Returns current marker start position.
256
- */
257
- getStart(): ModelPosition;
258
- /**
259
- * Returns current marker end position.
260
- */
261
- getEnd(): ModelPosition;
262
- /**
263
- * Returns a range that represents the current state of the marker.
264
- *
265
- * Keep in mind that returned value is a {@link module:engine/model/range~ModelRange Range}, not a
266
- * {@link module:engine/model/liverange~ModelLiveRange ModelLiveRange}. This means that it is up-to-date and relevant only
267
- * until next model document change. Do not store values returned by this method. Instead, store {@link ~Marker#name}
268
- * and get `Marker` instance from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection} every
269
- * time there is a need to read marker properties. This will guarantee that the marker has not been removed and
270
- * that it's data is up-to-date.
271
- */
272
- getRange(): ModelRange;
273
- /**
274
- * Converts `Marker` to plain object and returns it.
275
- *
276
- * @returns `Marker` converted to plain object.
277
- */
278
- toJSON(): unknown;
279
- /**
280
- * Binds new live range to the marker and detach the old one if is attached.
281
- *
282
- * @internal
283
- * @param liveRange Live range to attach
284
- * @returns Attached live range.
285
- */
286
- _attachLiveRange(liveRange: ModelLiveRange): ModelLiveRange;
287
- /**
288
- * Unbinds and destroys currently attached live range.
289
- *
290
- * @internal
291
- */
292
- _detachLiveRange(): void;
139
+ * `Marker` is a continuous part of the model (like a range), is named and represents some kind of information about the
140
+ * marked part of the model document. In contrary to {@link module:engine/model/node~ModelNode nodes}, which are building blocks of
141
+ * the model document tree, markers are not stored directly in the document tree but in the
142
+ * {@link module:engine/model/model~Model#markers model markers' collection}. Still, they are document data, by giving
143
+ * additional meaning to the part of a model document between marker start and marker end.
144
+ *
145
+ * In this sense, markers are similar to adding and converting attributes on nodes. The difference is that attribute is
146
+ * connected with a given node (e.g. a character is bold no matter if it gets moved or content around it changes).
147
+ * Markers on the other hand are continuous ranges and are characterized by their start and end position. This means that
148
+ * any character in the marker is marked by the marker. For example, if a character is moved outside of marker it stops being
149
+ * "special" and the marker is shrunk. Similarly, when a character is moved into the marker from other place in document
150
+ * model, it starts being "special" and the marker is enlarged.
151
+ *
152
+ * Another upside of markers is that finding marked part of document is fast and easy. Using attributes to mark some nodes
153
+ * and then trying to find that part of document would require traversing whole document tree. Marker gives instant access
154
+ * to the range which it is marking at the moment.
155
+ *
156
+ * Markers are built from a name and a range.
157
+ *
158
+ * Range of the marker is updated automatically when document changes, using
159
+ * {@link module:engine/model/liverange~ModelLiveRange live range} mechanism.
160
+ *
161
+ * Name is used to group and identify markers. Names have to be unique, but markers can be grouped by
162
+ * using common prefixes, separated with `:`, for example: `user:john` or `search:3`. That's useful in term of creating
163
+ * namespaces for custom elements (e.g. comments, highlights). You can use this prefixes in
164
+ * {@link module:engine/model/markercollection~MarkerCollection#event:update} listeners to listen on changes in a group of markers.
165
+ * For instance: `model.markers.on( 'update:user', callback );` will be called whenever any `user:*` markers changes.
166
+ *
167
+ * There are two types of markers.
168
+ *
169
+ * 1. Markers managed directly, without using operations. They are added directly by {@link module:engine/model/writer~ModelWriter}
170
+ * to the {@link module:engine/model/markercollection~MarkerCollection} without any additional mechanism. They can be used
171
+ * as bookmarks or visual markers. They are great for showing results of the find, or select link when the focus is in the input.
172
+ *
173
+ * 1. Markers managed using operations. These markers are also stored in {@link module:engine/model/markercollection~MarkerCollection}
174
+ * but changes in these markers is managed the same way all other changes in the model structure - using operations.
175
+ * Therefore, they are handled in the undo stack and synchronized between clients if the collaboration plugin is enabled.
176
+ * This type of markers is useful for solutions like spell checking or comments.
177
+ *
178
+ * Both type of them should be added / updated by {@link module:engine/model/writer~ModelWriter#addMarker}
179
+ * and removed by {@link module:engine/model/writer~ModelWriter#removeMarker} methods.
180
+ *
181
+ * ```ts
182
+ * model.change( ( writer ) => {
183
+ * const marker = writer.addMarker( name, { range, usingOperation: true } );
184
+ *
185
+ * // ...
186
+ *
187
+ * writer.removeMarker( marker );
188
+ * } );
189
+ * ```
190
+ *
191
+ * See {@link module:engine/model/writer~ModelWriter} to find more examples.
192
+ *
193
+ * Since markers need to track change in the document, for efficiency reasons, it is best to create and keep as little
194
+ * markers as possible and remove them as soon as they are not needed anymore.
195
+ *
196
+ * Markers can be downcasted and upcasted.
197
+ *
198
+ * Markers downcast happens on {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:addMarker} and
199
+ * {@link module:engine/conversion/downcastdispatcher~DowncastDispatcher#event:removeMarker} events.
200
+ * Use {@link module:engine/conversion/downcasthelpers downcast converters} or attach a custom converter to mentioned events.
201
+ * For {@link module:engine/controller/datacontroller~DataController data pipeline}, marker should be downcasted to an element.
202
+ * Then, it can be upcasted back to a marker. Again, use {@link module:engine/conversion/upcasthelpers upcast converters} or
203
+ * attach a custom converter to {@link module:engine/conversion/upcastdispatcher~UpcastDispatcher#event:element}.
204
+ *
205
+ * `Marker` instances are created and destroyed only by {@link ~MarkerCollection MarkerCollection}.
206
+ */
207
+ declare class Marker extends MarkerBase {
208
+ /**
209
+ * Marker's name.
210
+ */
211
+ readonly name: string;
212
+ /**
213
+ * Flag indicates if the marker is managed using operations or not.
214
+ *
215
+ * @internal
216
+ */
217
+ _managedUsingOperations: boolean;
218
+ /**
219
+ * Specifies whether the marker affects the data produced by the data pipeline
220
+ * (is persisted in the editor's data).
221
+ *
222
+ * @internal
223
+ */
224
+ _affectsData: boolean;
225
+ /**
226
+ * Range marked by the marker.
227
+ */
228
+ private _liveRange;
229
+ /**
230
+ * Creates a marker instance.
231
+ *
232
+ * @param name Marker name.
233
+ * @param liveRange Range marked by the marker.
234
+ * @param managedUsingOperations Specifies whether the marker is managed using operations.
235
+ * @param affectsData Specifies whether the marker affects the data produced by the data pipeline (is persisted in the editor's data).
236
+ */
237
+ constructor(name: string, liveRange: ModelLiveRange, managedUsingOperations: boolean, affectsData: boolean);
238
+ /**
239
+ * A value indicating if the marker is managed using operations.
240
+ * See {@link ~Marker marker class description} to learn more about marker types.
241
+ * See {@link module:engine/model/writer~ModelWriter#addMarker}.
242
+ */
243
+ get managedUsingOperations(): boolean;
244
+ /**
245
+ * A value indicating if the marker changes the data.
246
+ */
247
+ get affectsData(): boolean;
248
+ /**
249
+ * Returns the marker data (properties defining the marker).
250
+ */
251
+ getData(): MarkerData;
252
+ /**
253
+ * Returns current marker start position.
254
+ */
255
+ getStart(): ModelPosition;
256
+ /**
257
+ * Returns current marker end position.
258
+ */
259
+ getEnd(): ModelPosition;
260
+ /**
261
+ * Returns a range that represents the current state of the marker.
262
+ *
263
+ * Keep in mind that returned value is a {@link module:engine/model/range~ModelRange Range}, not a
264
+ * {@link module:engine/model/liverange~ModelLiveRange ModelLiveRange}. This means that it is up-to-date and relevant only
265
+ * until next model document change. Do not store values returned by this method. Instead, store {@link ~Marker#name}
266
+ * and get `Marker` instance from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection} every
267
+ * time there is a need to read marker properties. This will guarantee that the marker has not been removed and
268
+ * that it's data is up-to-date.
269
+ */
270
+ getRange(): ModelRange;
271
+ /**
272
+ * Converts `Marker` to plain object and returns it.
273
+ *
274
+ * @returns `Marker` converted to plain object.
275
+ */
276
+ toJSON(): unknown;
277
+ /**
278
+ * Binds new live range to the marker and detach the old one if is attached.
279
+ *
280
+ * @internal
281
+ * @param liveRange Live range to attach
282
+ * @returns Attached live range.
283
+ */
284
+ _attachLiveRange(liveRange: ModelLiveRange): ModelLiveRange;
285
+ /**
286
+ * Unbinds and destroys currently attached live range.
287
+ *
288
+ * @internal
289
+ */
290
+ _detachLiveRange(): void;
293
291
  }
294
292
  export { Marker };
295
293
  /**
296
- * Fired whenever {@link ~Marker#_liveRange marker range} is changed due to changes on {@link module:engine/model/document~ModelDocument}.
297
- * This is a delegated {@link module:engine/model/liverange~ModelLiveRange#event:change:range ModelLiveRange change:range event}.
298
- *
299
- * When marker is removed from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection},
300
- * all event listeners listening to it should be removed. It is best to do it on
301
- * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
302
- *
303
- * @see module:engine/model/liverange~ModelLiveRange#event:change:range
304
- * @eventName ~Marker#change:range
305
- */
294
+ * Fired whenever {@link ~Marker#_liveRange marker range} is changed due to changes on {@link module:engine/model/document~ModelDocument}.
295
+ * This is a delegated {@link module:engine/model/liverange~ModelLiveRange#event:change:range ModelLiveRange change:range event}.
296
+ *
297
+ * When marker is removed from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection},
298
+ * all event listeners listening to it should be removed. It is best to do it on
299
+ * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
300
+ *
301
+ * @see module:engine/model/liverange~ModelLiveRange#event:change:range
302
+ * @eventName ~Marker#change:range
303
+ */
306
304
  export type MarkerChangeRangeEvent = ModelLiveRangeChangeRangeEvent;
307
305
  /**
308
- * Fired whenever change on {@link module:engine/model/document~ModelDocument} is done inside {@link ~Marker#_liveRange marker range}.
309
- * This is a delegated {@link module:engine/model/liverange~ModelLiveRange#event:change:content ModelLiveRange change:content event}.
310
- *
311
- * When marker is removed from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection},
312
- * all event listeners listening to it should be removed. It is best to do it on
313
- * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
314
- *
315
- * @see module:engine/model/liverange~ModelLiveRange#event:change:content
316
- * @eventName ~Marker#change:content
317
- */
306
+ * Fired whenever change on {@link module:engine/model/document~ModelDocument} is done inside {@link ~Marker#_liveRange marker range}.
307
+ * This is a delegated {@link module:engine/model/liverange~ModelLiveRange#event:change:content ModelLiveRange change:content event}.
308
+ *
309
+ * When marker is removed from {@link module:engine/model/markercollection~MarkerCollection MarkerCollection},
310
+ * all event listeners listening to it should be removed. It is best to do it on
311
+ * {@link module:engine/model/markercollection~MarkerCollection#event:update MarkerCollection update event}.
312
+ *
313
+ * @see module:engine/model/liverange~ModelLiveRange#event:change:content
314
+ * @eventName ~Marker#change:content
315
+ */
318
316
  export type MarkerCollectionChangeContentEvent = ModelLiveRangeChangeContentEvent;
319
317
  /**
320
- * Describes `change:range` or `change:content` event.
321
- */
318
+ * Describes `change:range` or `change:content` event.
319
+ */
322
320
  export type MarkerChangeEvent = ModelLiveRangeChangeEvent;
323
321
  /**
324
- * Fired whenever marker is added, updated or removed from `MarkerCollection`.
325
- *
326
- * @eventName ~MarkerCollection#update
327
- * @param marker Updated Marker.
328
- * @param oldRange Marker range before the update. When is not defined it
329
- * means that marker is just added.
330
- * @param newRange Marker range after update. When is not defined it
331
- * means that marker is just removed.
332
- * @param oldMarkerData Data of the marker before the change.
333
- */
322
+ * Fired whenever marker is added, updated or removed from `MarkerCollection`.
323
+ *
324
+ * @eventName ~MarkerCollection#update
325
+ * @param marker Updated Marker.
326
+ * @param oldRange Marker range before the update. When is not defined it
327
+ * means that marker is just added.
328
+ * @param newRange Marker range after update. When is not defined it
329
+ * means that marker is just removed.
330
+ * @param oldMarkerData Data of the marker before the change.
331
+ */
334
332
  export type MarkerCollectionUpdateEvent = {
335
- name: 'update' | `update:${string}`;
336
- args: [marker: Marker, oldRange: ModelRange | null, newRange: ModelRange | null, oldMarkerData: MarkerData];
333
+ name: "update" | `update:${string}`;
334
+ args: [marker: Marker, oldRange: ModelRange | null, newRange: ModelRange | null, oldMarkerData: MarkerData];
337
335
  };
338
- /**
339
- * Cannot use a {@link module:engine/model/markercollection~MarkerCollection#destroy destroyed marker} instance.
340
- *
341
- * @error marker-destroyed
342
- */